X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2Fdom%2F11_XDomNode.js;fp=0.6.x%2Fjs%2Fdom%2F11_XDomNode.js;h=bff26274af0a1ba50f878f548d5eb08d27ed8afe;hb=282579dfd2bde19c4b96b71471ae21b5a4ae57a3;hp=86c75db526013fb2ca90414da3a70d86c076ac2e;hpb=ea77d51a454c9bb5290df42ffe45b7b1477eab16;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/dom/11_XDomNode.js b/0.6.x/js/dom/11_XDomNode.js index 86c75db..bff2627 100644 --- a/0.6.x/js/dom/11_XDomNode.js +++ b/0.6.x/js/dom/11_XDomNode.js @@ -33,7 +33,7 @@ X.Dom._strictElmCreation = X.UA.IE && X.UA.IE < 9;// && !X.UA.MacIE; /* * Node( rawElement | rawTextnode | htmlString | textString ) */ -//;(function( window, document, undeifned ){ + X.Dom.Node = X.EventDispatcher.inherits( 'XDomNode', X.Class.POOL_OBJECT, @@ -57,7 +57,7 @@ X.Dom.Node = X.EventDispatcher.inherits( _attrs : null, // X.Dom.Attr _newAttrs : null, - _attrText : ' ', // X.Dom.Attr.objToAttrText が必要な場合は false が入っている + _attrText : '', // X.Dom.Attr.objToAttrText が必要な場合は false が入っている _css : null, // X.Dom.Style _cssText : null, @@ -167,7 +167,7 @@ Node.IS_WINDOW = 8; Node.IS_DOCUMENT = 9; Node.IS_IMAGE = 10; -Node._useDocumentFragment = document.createDocumentFragment && ( !X.UA.IE || 6 <= X.UA.IE ) && document.createDocumentFragment(); +Node._useDocumentFragment = document.createDocumentFragment && ( !X.UA.IE || 5.5 <= X.UA.IE ) && document.createDocumentFragment(); Node._getType = function( v ){ if( v === '' ) return Node.IS_STRING; @@ -753,7 +753,7 @@ Node.prototype.html = function( html ){ '<', this._tag, this._id ? ' id="' + this._id + q : _, this._className ? ' class="' + this._className + q : _, - this._attrText || ( this._attrText = X.Dom.Attr.objToAttrText( this._attrs ) ), + this._attrText === false ? ( this._attrText = X.Dom.Attr.objToAttrText( this._attrs ) ) : this._attrText, this._cssText ? ' style="' + this._cssText + q : _, '>' ]; @@ -843,7 +843,7 @@ Node.prototype._startUpdate = function(){ tmp = this._rawNode.style.visibility; //this._rawNode.style.visibility = 'hidden'; - + if( i = removal.length ){ for( ; i; ){ xnode = removal[ --i ]; @@ -852,7 +852,7 @@ Node.prototype._startUpdate = function(){ }; removal.length = 0; }; - + Node._html._dirty ? Node._html._commitUpdate() : this._commitUpdate(); X.Dom._listeners && X.Dom._listeners[ X.Dom.Event.AFTER_UPDATE ] && X.Dom.asyncDispatch( 0, { type : X.Dom.Event.AFTER_UPDATE } ); @@ -963,30 +963,22 @@ Node.prototype._updateRawNode = }; // id if( this._dirty & X.Dom.Dirty.ID ){ - //if( X.UA.IE && X.UA.IE < 7 ){ - this._id ? ( elm.id = this._id ) : ( elm.id && elm.removeAttribute( 'id' ) ); - //} else { - // this._id ? ( elm.id = this._id ) : elm.removeAttribute( 'id' ); - //}; + this._id ? ( elm.id = this._id ) : ( elm.id && elm.removeAttribute( 'id' ) ); }; // className if( this._dirty & X.Dom.Dirty.CLASSNAME ){ - //if( X.UA.IE && X.UA.IE < 8 ){ - //elm.className = this._className; + this._className ? ( elm.className = this._className ) : ( elm.className && elm.removeAttribute( 'class' ) ); - //} else { - this._className ? ( elm.className = this._className ) : ( elm.className && elm.removeAttribute( 'class' ) ); - //}; - // ie5 only - if( X.Dom.State.IE5_DISPLAY_NONE_FIX && elm.currentStyle.display === 'none' ){ - this._actualRemove(); - this._state |= X.Dom.State.IE5_DISPLAY_NONE_FIX; - return; - }; + // ie5 only + if( X.Dom.State.IE5_DISPLAY_NONE_FIX && elm.currentStyle.display === 'none' ){ + this._actualRemove(); + this._state |= X.Dom.State.IE5_DISPLAY_NONE_FIX; + return; + }; }; // style if( this._dirty & X.Dom.Dirty.CSS ){ - if( this._cssText || ( this._cssText = X.Dom.Style.objToCssText( this._css ) ) ){ + if( this._cssText !== null || ( this._cssText = X.Dom.Style.objToCssText( this._css ) ) ){ X.UA.Opera && X.UA.Opera < 9 ? elm.setAttribute( 'style', this._cssText ) : // opera8用 ( elm.style.cssText = this._cssText ); @@ -1047,7 +1039,7 @@ Node.prototype._updateRawNode = }; // style if( this._dirty & X.Dom.Dirty.CSS ){ - if( this._cssText || ( this._cssText = X.Dom.Style.objToCssText( this._css ) ) ){ + if( this._cssText !== null || ( this._cssText = X.Dom.Style.objToCssText( this._css ) ) ){ elm.style.cssText = this._cssText; } else { elm.style.cssText = ''; @@ -1115,7 +1107,7 @@ Node.prototype._actualCreate = ' UID="', this._uid, '"', this._id ? ' id="' + this._id + '"' : '', this._className ? ' class="' + this._className + '"' : '', - this._attrText || ( this._attrText = X.Dom.Attr.objToAttrText( this._attrs ) ), + this._attrText === false ? ( this._attrText = X.Dom.Attr.objToAttrText( this._attrs ) ) : this._attrText, this._cssText ? ' style="' + this._cssText + '"' : '', '>' ].join( '' ) ) : document.createElement( this._tag ); @@ -1149,7 +1141,7 @@ Node.prototype._actualCreate = html = [ '<', this._tag, ' id=', ( this._id || ( 'ie4uid' + uid ) ), ' UID="', uid, '"', this._className ? ' class="' + this._className + '"' : '', - this._attrText || ( this._attrText = X.Dom.Attr.objToAttrText( this._attrs ) ), + this._attrText === false ? ( this._attrText = X.Dom.Attr.objToAttrText( this._attrs ) ) : this._attrText, this._cssText ? ' style="' + this._cssText + '"' : '', '>' ]; @@ -1179,7 +1171,9 @@ Node.prototype._actualCreate = Node.prototype._afterActualCreate = X.Dom.DOM_W3C ? (function(){ var elm = this._rawNode, xnodes, l, attrs, k, i; - + if( !this.parent ){ + alert( 'afterActualCreate : ' + this._tag ); + }; this._root = this.parent._root; if( this._xnodeType === 3 ){ @@ -1196,10 +1190,6 @@ Node.prototype._afterActualCreate = elm.appendChild( xnodes[ i ]._actualCreate( true ) ); }; }; - //if( X.UA.IE && X.UA.IE < 5.5 ){ - // this._dirty = X.Dom.Dirty.CSS | X.Dom.Dirty.IE_FILTER; - // this._updateRawNode( elm ); - //} else if( !X.Dom._strictElmCreation ){ elm.UID = this._uid; this._newAttrs = this._attrs; @@ -1261,7 +1251,11 @@ Node.prototype._actualRemove = if( !elm ) return; this._xnodeType === 1 && this._migrateEvent();// イベントの退避 // elm.parentNode.tagName for ie7 - !isChild && elm.parentNode && elm.parentNode.tagName && elm.parentNode.removeChild( elm ); + //if( !X.UA.Opera7 ){ + !isChild && elm.parentNode && elm.parentNode.tagName && elm.parentNode.removeChild( elm ); + //} else { + // !isChild && elm.parentNode && X.Dom._o7_remove( elm ); + //}; }) : X.Dom.DOM_IE4 ? ( function( isChild ){ @@ -1286,10 +1280,4 @@ Node.prototype._actualRemove = delete this._rawNode; }) : (function(){}); - - -//})( window, document ); - - -