OSDN Git Service

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