X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2Fdom%2F11_XDomNode.js;h=d04c661a8172b192532b69ffa6d890146d2d3dfd;hb=c2184d5500fe31de24e248c9cdf92b31e547fd0c;hp=bff26274af0a1ba50f878f548d5eb08d27ed8afe;hpb=282579dfd2bde19c4b96b71471ae21b5a4ae57a3;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 bff2627..d04c661 100644 --- a/0.6.x/js/dom/11_XDomNode.js +++ b/0.6.x/js/dom/11_XDomNode.js @@ -6,7 +6,7 @@ X.Dom.Dirty = { CLASSNAME : 8, // _getCharSize, width, height, x, y ATTR : 16, // _getCharSize, width, height, x, y CSS : 32, // _getCharSize, width, height, x, y - IE_FILTER : X.UA.IE && X.UA.IE < 9 ? 64 : 0, + IE_FILTER : X.UA.IE && X.UA.IE < 9 && !X.UA.MacIE ? 64 : 0, UNKNOWN_TAG_FIX : 128, IE4_TEXTNODE_FIX : 256 }; @@ -25,10 +25,12 @@ X.Dom.State = { HAS_HEIGHT_LENGTH : 512, HAS_HEIGHT_PERCENT : 1024, IE4_ONLY_TEXT : 2048, - IE5_DISPLAY_NONE_FIX : 5 <= X.UA.IE && X.UA.IE < 5.5 ? 4096 : 0 // MacIE5.2- は ? + IE5_DISPLAY_NONE_FIX : !X.UA.MacIE && 5 <= X.UA.IE && X.UA.IE < 5.5 ? 4096 : 0 // filterがかかっていると不可? MacIE5.2- は ? }; -X.Dom._strictElmCreation = X.UA.IE && X.UA.IE < 9;// && !X.UA.MacIE; +X.Dom._strictElmCreation = !X.UA.MacIE && X.UA.IE5678;// && !X.UA.MacIE; + +X.Dom._useDocumentFragment = document.createDocumentFragment && ( !X.UA.IE || 5.5 <= X.UA.IE ) && document.createDocumentFragment(); /* * Node( rawElement | rawTextnode | htmlString | textString ) @@ -167,8 +169,6 @@ Node.IS_WINDOW = 8; Node.IS_DOCUMENT = 9; Node.IS_IMAGE = 10; -Node._useDocumentFragment = document.createDocumentFragment && ( !X.UA.IE || 5.5 <= X.UA.IE ) && document.createDocumentFragment(); - Node._getType = function( v ){ if( v === '' ) return Node.IS_STRING; if( !v ) return 0; @@ -881,7 +881,7 @@ Node.prototype._commitUpdate = } else if( ( xnodes = this._xnodes ) && ( l = xnodes.length ) ) { - /*if( elm.childNodes.length !== l && ( frg = Node._useDocumentFragment ) ){ + /*if( elm.childNodes.length !== l && ( frg = X.Dom._useDocumentFragment ) ){ for( i = 0; i < l; ++i ){ frg.appendChild( xnodes[ i ]._actualCreate( true ) ); }; @@ -967,7 +967,7 @@ Node.prototype._updateRawNode = }; // className if( this._dirty & X.Dom.Dirty.CLASSNAME ){ - this._className ? ( elm.className = this._className ) : ( elm.className && elm.removeAttribute( 'class' ) ); + this._className ? ( elm.className = this._className ) : ( elm.className && elm.removeAttribute( X.UA.IE ? 'className' : 'class' ) ); // ie5 only if( X.Dom.State.IE5_DISPLAY_NONE_FIX && elm.currentStyle.display === 'none' ){ @@ -979,7 +979,7 @@ Node.prototype._updateRawNode = // style if( this._dirty & X.Dom.Dirty.CSS ){ if( this._cssText !== null || ( this._cssText = X.Dom.Style.objToCssText( this._css ) ) ){ - X.UA.Opera && X.UA.Opera < 9 ? + X.UA.Opera78 || X.UA.NN6 ? elm.setAttribute( 'style', this._cssText ) : // opera8用 ( elm.style.cssText = this._cssText ); } else { @@ -997,7 +997,7 @@ Node.prototype._updateRawNode = if( this._dirty & X.Dom.Dirty.ATTR && ( attrs = this._newAttrs || this._attrs ) ){ rename = X.Dom.Attr.renameForDOM; for( k in attrs ){ - if( 5 <= X.UA.IE && X.UA.IE < 6 ){ // IETester 5.5 ではエラーが出なかった.MultipulIE5.5 ではエラーが出たので + if( !X.UA.MacIE && 5 <= X.UA.IE && X.UA.IE < 6 ){ // IETester 5.5 ではエラーが出なかった.MultipulIE5.5 ではエラーが出たので if( this._tag === 'TEXTAREA' && k === 'value' ){ elm.firstChild ? ( elm.firstChild.data = attrs[ k ] ) : @@ -1112,9 +1112,9 @@ Node.prototype._actualCreate = '>' ].join( '' ) ) : document.createElement( this._tag ); }; - if( Node._useDocumentFragment ){ + if( X.Dom._useDocumentFragment ){ if( ( xnodes = this._xnodes ) && ( l = xnodes.length ) ){ - !isChild && ( frg = Node._useDocumentFragment ).appendChild( elm ); + !isChild && ( frg = X.Dom._useDocumentFragment ).appendChild( elm ); for( i = 0; i < l; ++i ){ elm.appendChild( xnodes[ i ]._actualCreate( true ) ); }; @@ -1171,9 +1171,7 @@ 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 ){ @@ -1185,7 +1183,7 @@ Node.prototype._afterActualCreate = l = xnodes && xnodes.length; if( this._isNew ){ - if( !Node._useDocumentFragment && l ){// docFrg が使えない場合、doc 追加後に子を追加 + if( !X.Dom._useDocumentFragment && l ){// docFrg が使えない場合、doc 追加後に子を追加 for( i = 0; i < l; ++i ){ elm.appendChild( xnodes[ i ]._actualCreate( true ) ); }; @@ -1251,11 +1249,11 @@ Node.prototype._actualRemove = if( !elm ) return; this._xnodeType === 1 && this._migrateEvent();// イベントの退避 // elm.parentNode.tagName for ie7 - //if( !X.UA.Opera7 ){ + if( !X.UA.MacIE ){ !isChild && elm.parentNode && elm.parentNode.tagName && elm.parentNode.removeChild( elm ); - //} else { - // !isChild && elm.parentNode && X.Dom._o7_remove( elm ); - //}; + } else { + !isChild && elm.parentNode && elm.parentNode.tagName && X.Dom._fixed_remove( elm, this ); + }; }) : X.Dom.DOM_IE4 ? ( function( isChild ){ @@ -1275,7 +1273,7 @@ Node.prototype._actualRemove = this._attrs.value = elm.value; }; elm.removeAttribute( 'id' ); // ? - document.all[ this._id || ( 'ie4uid' + this._uid ) ] = null; // ? + document.all[ this._id || ( 'ie4uid' + this._uid ) ] = null; // MacIE5 でエラー if( !isChild ) elm.outerHTML = ''; delete this._rawNode; }) :