var XDomStyle = X.Dom.Style,
args = arguments,
css = this._css,
- p, valOrUnit, name, v, node, camelize, unit;
+ p, valOrUnit, name, v, camelize, unit;
if( this._xnodeType !== 1 ) return this;
// setter:object
if( X.Type.isObject( nameOrObj ) ){
for( p in nameOrObj ){
css[ camelize( p ) ] = nameOrObj[ p ];
};
- this._cssText = XDomStyle.objToCssText( this._css );
- if( node = this._ie4getRawNode ? this._ie4getRawNode() : this._rawNode ){
- if( this._cssText ){
- node.style.cssText = this._cssText;
- this._styleText = ' style="' + this._cssText + '"';
- } else {
- node.removeAttribute( 'style' );
- delete this._cssText;
- delete this._styleText;
- };
- };
+ this._dirty |= X.Dom.Dirty.CSS;
+ this.parent && this._reserveUpdate();
+ delete this._cssText;
return this;
} else
if( 1 < args.length ){
if( !css ) css = this._css = {};
name = XDomStyle.camelize( nameOrObj );
v = args[ 1 ];
- node = this._ie4getRawNode ? this._ie4getRawNode() : this._rawNode;
if( css[ name ] === v ) return this;
if( !v && v !== 0 ){
delete css[ name ];
- if( node ){
- node.style[ name ] = ''; // val
- };
- this._cssText = XDomStyle.objToCssText( css );
- if( !this._cssText ){
- delete this._cssText;
- delete this._styleText;
- node && node.removeAttribute( 'style' );
- };
- return this;
- };
- if( node ){
- node.style[ name ] = v; // val
- };
- if( !css[ name ] ){
- this._cssText = [ this._cssText, this._cssText ? ';' : '', XDomStyle.uncamelize( nameOrObj ), ':', v ].join( '' );
- css[ name ] = v;
} else {
css[ name ] = v;
- this._cssText = XDomStyle.objToCssText( css );
};
- this._styleText = ' style="' + this._cssText + '"';
+ delete this._cssText;
+ this._dirty |= X.Dom.Dirty.CSS;
+ // parent でなく this._root!
+ this.parent && this._reserveUpdate();
return this;
};
// getter unit
};
X.Dom.Node.prototype.cssText = function( v ){
- var camelize, obj, i, l, attr, name;
+ var obj, i, l, attr, name;
if( X.Type.isString( v ) ){
- camelize = X.Dom.Style.camelize;
obj = {};
v = v.split( ';' );
delete this._css;
for( i = 0, l = v.length; i < l; ++i ){
attr = v[ i ].split( ':' );
- name = camelize( attr[ 0 ] );
- name && ( obj[ name ] = attr[ 1 ] || true );
+ ( name = attr[ 0 ] ) && ( obj[ name ] = attr[ 1 ] || true );
};
return this.css( obj );
};
};
/*
- * ã\81\93ã\81\93ã\81§ã\81¯ HTMLElement ã\81\8bã\81®ã\83\81ã\83£ã\83\83ã\82¯ã\81¯è¡\8cã\82\8fã\81ªã\81\84ï¼\81
+ * ここでは HTMLElement のチャックは行わない!
*/
X.Dom.Node.prototype._getCharSize =
window.getComputedStyle ?