X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F02_dom%2F22_XTreeBuilder.js;h=b7455e338d254c4f20608913b33bf27f2d38b87f;hb=9e30a8480de03f0b36d2411a0ecb7f1d0f47b61f;hp=caf655535b1ea339d50fa3ecb68a47c16426656a;hpb=4f345667eeb8d229766fbcd5097d733b7c26ef41;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/02_dom/22_XTreeBuilder.js b/0.6.x/js/02_dom/22_XTreeBuilder.js index caf6555..b7455e3 100644 --- a/0.6.x/js/02_dom/22_XTreeBuilder.js +++ b/0.6.x/js/02_dom/22_XTreeBuilder.js @@ -342,7 +342,7 @@ X_TEMP.bindElementToXnode = continue; }; - if( xnode._xnodeType === 1 ){ + if( xnode._tag ){ if( elm.nodeType === 3 ){ if( !( text = elm.data ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ //alert( text.charCodeAt( 0 ) ); @@ -367,8 +367,8 @@ X_TEMP.bindElementToXnode = if( tag.charAt( 0 ) === '/' ) tag = tag.slice( 1 ); xnode._tag = tag; //}; - xnode._root = parent._root; - xnode._dirty = 0; + xnode._flags |= X_Node_State.IN_TREE; + xnode._flags &= X_Node_BitMask_RESET_DIRTY; elm.UID = xnode._uid; current.xtext = null; @@ -376,10 +376,6 @@ X_TEMP.bindElementToXnode = xnode.attr( 'value', xnode.html() ).empty(); } else - //if( X_TEMP._isCleanupTarget( elm ) ){// !xnode.hasClass( 'skip-cleanup' ) && ( X_Dom_DTD_CLEANUP_TAGS[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ // ie で body 内の script が2度よばれるのに対処 - //alert( '[' +parent._tag + '>' + xnode._tag + '] remove ... ' ); - //xnode.destroy(); - //} else if( elm.childNodes && elm.childNodes.length ){ //alert( '[' +parent._tag + '>' + xnode._tag + ' ' + (xnode._xnodes ? xnode._xnodes.length : '' ) + '] === ' + tag + ' ' + (elm.childNodes ? elm.childNodes.length : '' ) + ' Hit\n' + elm.outerHTML ); //current.xtext = null; @@ -411,17 +407,18 @@ X_TEMP.bindElementToXnode = break; }; alert( parent._tag + ' > ' + '"' + xnode._text + '" !== ' + tag + '\n' + - 'prev : ' + ( xnode.prevNode() && xnode.prevNode().html() ) + '\n' + - 'next : ' + ( xnode.nextNode() && xnode.nextNode().html() ) + '\n' + + 'prev : ' + ( xnode.prev() && xnode.prev().html() ) + '\n' + + 'next : ' + ( xnode.next() && xnode.next().html() ) + '\n' + 'html : ' + elm.outerHTML ); break; }; ++current.j; xnode._rawObject = elm; - xnode._dirty = 0; + xnode._flags |= X_Node_State.IN_TREE; + xnode._flags &= X_Node_BitMask_RESET_DIRTY; xnode._text = elm.data; // 正確 - xnode._root = parent._root; + if( !skipCleanup ){ if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ console.log( '[' +parent._tag + '>' + xnode._uid + '] destroy ... ' ); @@ -455,11 +452,14 @@ X_TEMP.bindElementToXnode = xnode.parent = parent; - if( xnode._xnodeType === 3 ){ + if( !xnode._tag ){ + xnode._flags |= X_Node_State.IN_TREE; + xnode._flags &= X_Node_BitMask_RESET_DIRTY; //alert( X_String_cleanupWhiteSpace( xnode._text ) ); if( !skipCleanup ){ if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ xnode.destroy(); + xnode = null; } else if( xtext ){ //alert( 'xtext ' + text.charCodeAt( 0 ) + ' : ' + text.length ); @@ -469,19 +469,15 @@ X_TEMP.bindElementToXnode = //alert( 'xnode ' + text.charCodeAt( 0 ) + ' : ' + text.length ); xnode.text( text ); }; - } else - if( xtext ){ - //alert( 'skip ' + text.charCodeAt( 0 ) + ' : ' + text.length ); - xtext.text( xtext._text + xnode._text ); - xnode.destroy(); + } else { + if( xtext ){ + //alert( 'skip ' + text.charCodeAt( 0 ) + ' : ' + text.length ); + xtext.text( xtext._text + xnode._text ); + xnode.destroy(); + }; }; - current.flag |= 4; current.xtext = xtext || xnode; - return; - }; - - if( xnode._xnodeType !== 1 ){ - //alert( xnode._xnodeType ) + parent._flags |= X_Node_State.IE4_HAS_TEXTNODE; return; }; @@ -501,8 +497,8 @@ X_TEMP.bindElementToXnode = ++current.j; xnode._rawObject = elm; - xnode._dirty = 0; - xnode._root = parent._root; + xnode._flags |= X_Node_State.IN_TREE; + xnode._flags &= X_Node_BitMask_RESET_DIRTY; //xnode._tag = X_Dom_DTD_TAG_FIX[ tag ] || tag; if( X_TEMP._isCleanupTarget( elm ) ){ //!xnode.hasClass( 'skip-cleanup' ) && ( X_Dom_DTD_CLEANUP_TAGS[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ xnode.destroy(); @@ -517,7 +513,7 @@ X_TEMP.bindElementToXnode = ( xnode._attrs = { type : 'text' } ) : xnode._attrs.type || ( xnode._attrs.type = 'text' ) ); - current.flag |= 3; + parent._flags |= X_Node_State.IE4_HAS_ELEMENT; current.xtext = null; if( tag === 'TEXTAREA' ){ @@ -543,9 +539,6 @@ X_TEMP.bindElementToXnode = if( !xnode._rawObject ){ alert( xnode._tag + ' ' + xnode._id + ' !== none...' ); }; - - // textNode がある - ( current.flag & 6 ) && ( parent._dirty |= X_Node_Dirty.IE4_TEXTNODE_FIX ); }); console.log( 'X.Dom.Builder' );