X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F02_dom%2F22_XTreeBuilder.js;h=72eae6bda6633a21ec343386b27ec07a863d3c57;hb=e28511741c97176b8ffe67bb1ea0660da37f754b;hp=a422d9d11fc3691cced72b1f569c2ce15052fd19;hpb=572e81e88d5e6f8e3c5d73df7c95e61f1c4544e0;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 a422d9d..72eae6b 100644 --- a/0.6.x/js/02_dom/22_XTreeBuilder.js +++ b/0.6.x/js/02_dom/22_XTreeBuilder.js @@ -8,7 +8,7 @@ X_TEMP._isCleanupTarget = function( elm ){ ( X_Dom_DTD_CLEANUP_TAGS[ tag ] || cname.indexOf( ' cleanup-target ' ) !== -1 ); }; -if( X_UA.MacIE ){ +if( X_UA[ 'MacIE' ] ){ X_TEMP._fixed_remove = function( node, xnode ){ var parent = node.parentNode, l; @@ -22,26 +22,27 @@ if( X_UA.MacIE ){ //node.data = ''; l = X_TEMP._removalTextNodes.length; if( parent ){ - //!l && X.Timer.once( 0, X_TEMP._timerRemove ); - //X_TEMP._removalTextNodes[ l ] = node; - //var str=[],p; - //for( p in node ){ - // str[str.length] = p; - //}; - //alert( str.join( ',' ) + parent.innerHTML ); - //node.nodeValue = ''; - //parent.replaceChild( document.createElement( 'span' ), node ); - //var e; - //var f = document.createDocumentFragment(); - //f.appendChild( e = document.createElement( 'span' ) ); - //f.replaceChild( node, e ); - //e.appendChild( f ); - //parent.appendChild( e = document.createElement( 'span' ) ); - //e.appendChild( node ); - //parent.removeChild( e ); - //node.parentNode = null; - //document.body.appendChild( node ); - //parent.replaceChild( document.createComment( '' ), node ); + /* + !l && X_Timer_once( 0, X_TEMP._timerRemove ); + X_TEMP._removalTextNodes[ l ] = node; + var str=[],p; + for( p in node ){ + str[str.length] = p; + }; + alert( str.join( ',' ) + parent.innerHTML ); + node.nodeValue = ''; + parent.replaceChild( document.createElement( 'span' ), node ); + var e; + var f = document.createDocumentFragment(); + f.appendChild( e = document.createElement( 'span' ) ); + f.replaceChild( node, e ); + e.appendChild( f ); + parent.appendChild( e = document.createElement( 'span' ) ); + e.appendChild( node ); + parent.removeChild( e ); + node.parentNode = null; + document.body.appendChild( node ); + parent.replaceChild( document.createComment( '' ), node ); */ document.body.appendChild( node ); return; if( parent.parentNode !== document.body ){ @@ -56,7 +57,7 @@ if( X_UA.MacIE ){ parent.parentNode.insertBefore( clone, parent ); parent.style.display = 'none'; if( xnode ){ - xnode.parent.parent._rawObject = clone; + xnode.parent.parent[ '_rawObject' ] = clone; }; } else { // ignore @@ -82,11 +83,11 @@ if( X_UA.MacIE ){ }; }; - //nodes.length && X.Timer.once( 1000, X_TEMP._timerRemove ); + //nodes.length && X_Timer_once( 1000, X_TEMP._timerRemove ); }; } else -if( X_UA.Opera7 ){ +if( X_UA[ 'Opera7' ] ){ X_TEMP._fixed_remove = function( node ){ if( node.nodeType === 1 || node.nodeType === 3 ){ @@ -105,11 +106,12 @@ if( X_UA.Opera7 ){ * http://kojs.sukobuto.com/docs/visible-binding * IE6 には、「空の span エレメントに続く空白は無視される」という謎な癖があります。 */ -X.ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, + +X_TEMP._onPreInit = X_UA_DOM.W3C ? (function(){ var r = X_Node_body, - body = r._rawObject, + body = r[ '_rawObject' ], copy, i, l, node, html, elmProgress; @@ -119,10 +121,10 @@ X.ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, // TODO // textarea の内容を控えて、消す。xnode tree 構築後に復帰。でないと、html パースでこける - //X_UA.MacIE && alert( body.innerHTML ); + //X_UA[ 'MacIE' ] && alert( body.innerHTML ); // cleanup tree - (function/*cleanUpTree*/( elm, skip, head ){ - var nodes = X_Object_cloneArray( elm.childNodes ), + function cleanUpTree( elm, skip, head ){ + var nodes = X_Array_copy( elm.childNodes ), i = 0, l = nodes.length, node, tag, textNode, content; @@ -141,7 +143,7 @@ X.ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, continue; } else { // pre タグ以下はスペースの置換は行わない - node.childNodes && node.childNodes.length && /*cleanUpTree*/arguments.callee( node, skip || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ], head ); + node.childNodes && node.childNodes.length && cleanUpTree( node, skip || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ], head ); }; textNode = null; break; @@ -159,7 +161,7 @@ X.ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, // ブロック要素直下のスペースだけは削除?? default : //console.log( 'Remove type: ' + node.nodeType + ' value: ' + node.nodeValue ); - if( !X_UA.Opera7 /*&& !X_UA.MacIE */ ){ + if( !X_UA[ 'Opera7' ] /*&& !X_UA[ 'MacIE' ] */ ){ elm.removeChild( node ); } else { X_TEMP._fixed_remove( node ); @@ -167,13 +169,15 @@ X.ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, //++count; }; }; - })( X_UA.MacIE ? ( copy = body.cloneNode( true ) ) : body ); + }; - if( X_UA.MacIE ){ + cleanUpTree( X_UA[ 'MacIE' ] ? ( copy = body.cloneNode( true ) ) : body ); + + if( X_UA[ 'MacIE' ] ){ document.write( html = copy.innerHTML ); } else { // body の属性値の取得 - if( X_UA.IE5678 ){ + if( X_UA[ 'IE' ] <= 8 ){ html = body.innerHTML.split( X_String_CRLF ).join( '' ); // 不要な改行が入る } else { html = body.innerHTML; @@ -189,35 +193,26 @@ X.ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, }; }; - body.appendChild( elmProgress = document.createElement( 'div' ) ); + body.appendChild( X_TEMP.elmProgress = elmProgress = document.createElement( 'div' ) ); elmProgress.style.cssText = 'position:absolute;top:0;left:0;z-index:9999;width:0;height:0.5em;background:#00f;overflow:hidden;'; elmProgress.setAttribute( 'style', 'position:absolute;top:0;left:0;z-index:9999;width:0;height:0.5em;background:#00f;overflow:hidden;' ); + X_TEMP._body = body; + X_HTMLParser_asyncParse( html, true ) - .listen( X.Event.PROGRESS, - function(e){ - elmProgress.style.width = ( e.percent * 100 | 0 ) + '%'; - } - ) - .listenOnce( X.Event.SUCCESS, function( e ){ - var xnodes = X_Node_body._xnodes = [], t; - xnodes.push.apply( xnodes, e.xnodes ); - elmProgress.style.width = '100%'; - - X_TEMP.asyncCreateTree( X_Node_body, body.childNodes, elmProgress ); - } ); + [ 'listen' ]( X_EVENT_PROGRESS, X_TEMP._handleEvent ) + [ 'listenOnce' ]( X_EVENT_SUCCESS, X_TEMP._handleEvent ); }) : -X_UA_DOM.IE4 ? +// X_UA_DOM.IE4 ? (function(){ var r = X_Node_body, - body = r._rawObject, + body = r[ '_rawObject' ], elmProgress = '_xdom_builder_progress', html; - if( !X_TEMP.X_Dom_useBuilder ) return; - + /* * http://support.microsoft.com/kb/812417/ja * PRB: outerHTML の HTML 要素のプロパティは、既定の属性は表示されません。 @@ -226,30 +221,42 @@ X_UA_DOM.IE4 ? */ html = body.innerHTML; body.insertAdjacentHTML( 'BeforeEnd', '
' ); - elmProgress = document.all[ elmProgress ]; + X_TEMP.elmProgress = document.all[ elmProgress ]; + + X_TEMP._body = body; X_HTMLParser_asyncParse( html, true ) - .listen( X.Event.PROGRESS, - function( e ){ - elmProgress.style.width = ( e.percent * 100 | 0 ) + '%'; - } - ) - .listenOnce( X.Event.SUCCESS, - function( e ){ - var xnodes = X_Node_body._xnodes = [], t; - xnodes.push.apply( xnodes, e.xnodes ); - elmProgress.style.width = '100%'; - - X_TEMP.asyncCreateTree( X_Node_body, body.childNodes || body.children, elmProgress ); - } - ); -}) : -(function(){ + [ 'listen' ]( X_EVENT_PROGRESS, X_TEMP._handleEvent ) + [ 'listenOnce' ]( X_EVENT_SUCCESS, X_TEMP._handleEvent ); +}); + +X_ViewPort[ 'listenOnce' ]( X_EVENT_PRE_INIT, X_TEMP._onPreInit ); + +X_TEMP._handleEvent = function( e ){ + var elmProgress = X_TEMP.elmProgress, xnodes; -}) ); + switch( e.type ){ + case X_EVENT_PROGRESS : + elmProgress.style.width = ( e.percent * 100 | 0 ) + '%'; + break; + + case X_EVENT_SUCCESS : + xnodes = X_Node_body[ '_xnodes' ] = []; + + xnodes.push.apply( xnodes, e.xnodes ); + elmProgress.style.width = '100%'; + + X_TEMP.asyncCreateTree( X_Node_body, X_TEMP._body.childNodes || X_TEMP._body.children, elmProgress ); + + delete X_TEMP._onPreInit; + delete X_TEMP._body; + delete X_TEMP.elmProgress; + break; + }; +}; -X_TEMP.asyncCreateTree = function ( parent, elems, elmProgress, async ){ - var xnodes = async ? 0 : X_Object_cloneArray( parent._xnodes ), +X_TEMP.asyncCreateTree = function( parent, elems, elmProgress, async ){ + var xnodes = async ? 0 : X_Array_copy( parent[ '_xnodes' ] ), l = async ? 0 : xnodes.length, stack = async ? async.stack : [], done = async ? async.done : 0, @@ -259,7 +266,7 @@ X_TEMP.asyncCreateTree = function ( parent, elems, elmProgress, async ){ xnodes : xnodes, l : l, i : 0, - elems : X_Object_cloneArray( elems ), + elems : X_Array_copy( elems ), j : 0, xtext : null, flag : 0 @@ -297,7 +304,7 @@ X_TEMP.asyncCreateTree = function ( parent, elems, elmProgress, async ){ async.done = done; }; //alert( 'koko?' ); - X.Timer.once( 0, X_TEMP.asyncCreateTree, [ null, null, elmProgress, async || { stack : stack, current : i < l && current, done : done } ] ); + X_Timer_once( 0, X_TEMP.asyncCreateTree, [ null, null, elmProgress, async || { stack : stack, current : i < l && current, done : done } ] ); // progress elmProgress.style.width = ( ( 1 - done / X_Node_CHASHE.length ) * 100 | 0 ) + '%'; return; @@ -307,8 +314,10 @@ X_TEMP.asyncCreateTree = function ( parent, elems, elmProgress, async ){ current = null; }; // complete - X_ViewPort.asyncDispatch( X_TEMP.SYSTEM_EVENT_XTREE ); + console.log( 'xtree 作成完了' ); + X_ViewPort[ 'asyncDispatch' ]( X_EVENT_XTREE_READY ); elmProgress.parentNode ? elmProgress.parentNode.removeChild( elmProgress ) : ( elmProgress.outerHTML = '' ); + delete X_TEMP.asyncCreateTree; delete X_TEMP.bindElementToXnode; delete X_TEMP.X_Dom_useBuilder; @@ -334,7 +343,7 @@ X_TEMP.bindElementToXnode = elm = elems[ current.j ]; tag = elm.tagName && elm.tagName.toUpperCase(); if( ( elm.nodeType !== 1 && elm.nodeType !== 3 ) || tag === '!' || ( tag && tag.charAt( 0 ) === '/' ) ){ - if( !X_UA.Opera7 && !X_UA.MacIE ){ + if( !X_UA[ 'Opera7' ] && !X_UA[ 'MacIE' ] ){ elm.parentNode.removeChild( elm ); } else { X_TEMP._fixed_remove( elm ); @@ -342,57 +351,53 @@ 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 ) ); - if( !X_UA.Opera7 && !X_UA.MacIE ){ + if( !X_UA[ 'Opera7' ] && !X_UA[ 'MacIE' ] ){ elm.parentNode.removeChild( elm ); } else { X_TEMP._fixed_remove( elm ); }; continue; }; - alert( '1:[' +parent._tag + '>' +xnode._tag + '] !== ' + elm.nodeType + '\n' + ( elm.data ) ); + alert( '1:[' +parent[ '_tag' ] + '>' +xnode[ '_tag' ] + '] !== ' + elm.nodeType + '\n' + ( elm.data ) ); } else if( X_Dom_DTD_MOVE_TO_HEAD[ tag ] ){ alert( tag ); continue; } else - if( xnode._tag !== tag ){ - alert( '2:[' +parent._tag + '>' +xnode._tag + ' len:' + (xnode._xnodes ? xnode._xnodes.length : '' ) + '] !== ' + tag + ' ' + (elm.childNodes ? elm.childNodes.length : '' ) + '\n' + elm.outerHTML ); + if( xnode[ '_tag' ] !== tag ){ + alert( '2:[' +parent[ '_tag' ] + '>' +xnode[ '_tag' ] + ' len:' + (xnode[ '_xnodes' ] ? xnode[ '_xnodes' ].length : '' ) + '] !== ' + tag + ' ' + (elm.childNodes ? elm.childNodes.length : '' ) + '\n' + elm.outerHTML ); } else { - xnode._rawObject = elm; + xnode[ '_rawObject' ] = elm; //if( ( doc = elm.ownerDocument || elm.document ) && ( doc.createElement( 'p' ).tagName === doc.createElement( 'P' ).tagName ) ){ if( tag.charAt( 0 ) === '/' ) tag = tag.slice( 1 ); - xnode._tag = tag; + xnode[ '_tag' ] = tag; //}; - xnode._root = parent._root; - xnode._flags &= X_Node_DIRTY_MASK_RESET; - elm.UID = xnode._uid; + xnode[ '_flags' ] |= X_NodeFlags_IN_TREE; + xnode[ '_flags' ] &= X_Node_BitMask_RESET_DIRTY; + elm[ 'UID' ] = xnode[ '_uid' ]; current.xtext = null; if( tag === 'TEXTAREA' ){ - xnode.attr( 'value', xnode.html() ).empty(); + 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 ); + //alert( '[' +parent[ '_tag' ] + '>' + xnode[ '_tag' ] + ' ' + (xnode[ '_xnodes' ] ? xnode[ '_xnodes' ].length : '' ) + '] === ' + tag + ' ' + (elm.childNodes ? elm.childNodes.length : '' ) + ' Hit\n' + elm.outerHTML ); //current.xtext = null; ++current.j; return { me : xnode, - xnodes : X_Object_cloneArray( xnode._xnodes ), + xnodes : X_Array_copy( xnode[ '_xnodes' ] ), xtext : null, flag : 0, i : 0, - l : xnode._xnodes.length, - elems : X_Object_cloneArray( elm.childNodes ), + l : xnode[ '_xnodes' ].length, + elems : X_Array_copy( elm.childNodes ), j : 0, skipCleanup : skipCleanup || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ] }; @@ -405,41 +410,42 @@ X_TEMP.bindElementToXnode = }; if( elm.nodeType !== 3 ){ - if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ - console.log( '[' +parent._tag + '> UID:' + xnode._uid + ' len:' + xnode._text.length + ' code : ' + xnode._text.charCodeAt( 0 ) + ',' + xnode._text.charCodeAt( 1 ) + '] destroyed.' ); - xnode.destroy(); + if( !( text = xnode[ '_text' ] ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ + console.log( '[' +parent[ '_tag' ] + '> UID:' + xnode[ '_uid' ] + ' len:' + xnode[ '_text' ].length + ' code : ' + xnode[ '_text' ].charCodeAt( 0 ) + ',' + xnode[ '_text' ].charCodeAt( 1 ) + '] destroyed.' ); + xnode[ 'kill' ](); break; }; - alert( parent._tag + ' > ' + '"' + xnode._text + '" !== ' + tag + '\n' + - 'prev : ' + ( xnode.prevNode() && xnode.prevNode().html() ) + '\n' + - 'next : ' + ( xnode.nextNode() && xnode.nextNode().html() ) + '\n' + + alert( parent[ '_tag' ] + ' > ' + '"' + xnode[ '_text' ] + '" !== ' + tag + '\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._flags &= X_Node_DIRTY_MASK_RESET; - xnode._text = elm.data; // 正確 - xnode._root = parent._root; + xnode[ '_rawObject' ] = elm; + xnode[ '_flags' ] |= X_NodeFlags_IN_TREE; + xnode[ '_flags' ] &= X_Node_BitMask_RESET_DIRTY; + xnode[ '_text' ] = elm.data; // 正確 + if( !skipCleanup ){ - if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ - console.log( '[' +parent._tag + '>' + xnode._uid + '] destroy ... ' ); - xnode.destroy(); + if( !( text = xnode[ '_text' ] ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ + console.log( '[' +parent[ '_tag' ] + '>' + xnode[ '_uid' ] + '] destroy ... ' ); + xnode[ 'kill' ](); }; if( xtext ){ - xtext.text( xtext._text + text ); - console.log( '[' +parent._tag + '>' + xnode._uid + '] xtext,destroy ... ' ); - xnode.destroy(); + xtext[ 'text' ]( xtext[ '_text' ] + text ); + console.log( '[' +parent[ '_tag' ] + '>' + xnode[ '_uid' ] + '] xtext,destroy ... ' ); + xnode[ 'kill' ](); } else { - //alert( parent._tag + '>' + '"' + text + '"\n' + elm.data ); - xnode.text( text ); + //alert( parent[ '_tag' ] + '>' + '"' + text + '"\n' + elm.data ); + xnode[ 'text' ]( text ); }; } else if( xtext ){ - xtext.text( xtext._text + xnode._text ); - console.log( '[' +parent._tag + '>' + xnode._uid + '] xtext,destroy ... ' ); - xnode.destroy(); + xtext[ 'text' ]( xtext[ '_text' ] + xnode[ '_text' ] ); + console.log( '[' +parent[ '_tag' ] + '>' + xnode[ '_uid' ] + '] xtext,destroy ... ' ); + xnode[ 'kill' ](); }; current.xtext = xtext || xnode; break; @@ -455,33 +461,32 @@ X_TEMP.bindElementToXnode = xnode.parent = parent; - if( xnode._xnodeType === 3 ){ - //alert( X_String_cleanupWhiteSpace( xnode._text ) ); + if( !xnode[ '_tag' ] ){ + xnode[ '_flags' ] |= X_NodeFlags_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(); + if( !( text = xnode[ '_text' ] ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ + xnode[ 'kill' ](); + xnode = null; } else if( xtext ){ //alert( 'xtext ' + text.charCodeAt( 0 ) + ' : ' + text.length ); - xtext.text( xtext._text + text ); - xnode.destroy(); + xtext[ 'text' ]( xtext[ '_text' ] + text ); + xnode[ 'kill' ](); } else { //alert( 'xnode ' + text.charCodeAt( 0 ) + ' : ' + text.length ); - xnode.text( text ); + xnode[ 'text' ]( text ); + }; + } else { + if( xtext ){ + //alert( 'skip ' + text.charCodeAt( 0 ) + ' : ' + text.length ); + xtext[ 'text' ]( xtext[ '_text' ] + xnode[ '_text' ] ); + xnode[ 'kill' ](); }; - } 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_NodeFlags_IE4_HAS_TEXTNODE; return; }; @@ -495,43 +500,43 @@ X_TEMP.bindElementToXnode = //alert( '## ' + tag ); continue; } else - if( xnode._tag !== tag ){ - alert( xnode._tag + ' ' + ' !== ' + tag + '\nxnode.html():' + xnode.attr('cite') + '\nelm.outerHTML:' + elm.outerHTML ); + if( xnode[ '_tag' ] !== tag ){ + alert( xnode[ '_tag' ] + ' ' + ' !== ' + tag + '\nxnode.html():' + xnode.attr('cite') + '\nelm.outerHTML:' + elm.outerHTML ); } else { ++current.j; - xnode._rawObject = elm; - xnode._flags &= X_Node_DIRTY_MASK_RESET; - xnode._root = parent._root; - //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(); + xnode[ '_rawObject' ] = elm; + xnode[ '_flags' ] |= X_NodeFlags_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[ 'kill' ](); break; }; - !xnode._id && elm.setAttribute( 'id', 'ie4uid' + xnode._uid ); - elm.setAttribute( 'UID', xnode._uid ); + !xnode[ '_id' ] && elm.setAttribute( 'id', 'ie4uid' + xnode[ '_uid' ] ); + elm.setAttribute( 'UID', xnode[ '_uid' ] ); tag === 'INPUT' && ( - !xnode._attrs ? - ( xnode._attrs = { type : 'text' } ) : - xnode._attrs.type || ( xnode._attrs.type = 'text' ) + !xnode[ '_attrs' ] ? + ( xnode[ '_attrs' ] = { type : 'text' } ) : + xnode[ '_attrs' ].type || ( xnode[ '_attrs' ].type = 'text' ) ); - current.flag |= 3; + parent[ '_flags' ] |= X_NodeFlags_IE4_HAS_ELEMENT; current.xtext = null; if( tag === 'TEXTAREA' ){ - xnode.attr( 'value', xnode.html() ).empty(); + xnode[ 'attr' ]( 'value', xnode[ 'html' ]() )[ 'empty' ](); } else - if( xnode._xnodes && xnode._xnodes.length ){ + if( xnode[ '_xnodes' ] && xnode[ '_xnodes' ].length ){ return { me : xnode, - xnodes : X_Object_cloneArray( xnode._xnodes ), + xnodes : X_Array_copy( xnode[ '_xnodes' ] ), xtext : null, flag : 0, i : 0, - l : xnode._xnodes.length, - elems : X_Object_cloneArray( elm.children ), + l : xnode[ '_xnodes' ].length, + elems : X_Array_copy( elm.children ), j : 0, skipCleanup : skipCleanup || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ] }; @@ -540,12 +545,9 @@ X_TEMP.bindElementToXnode = }; }; // for - if( !xnode._rawObject ){ - alert( xnode._tag + ' ' + xnode._id + ' !== none...' ); + if( !xnode[ '_rawObject' ] ){ + alert( xnode[ '_tag' ] + ' ' + xnode[ '_id' ] + ' !== none...' ); }; - - // textNode がある - ( current.flag & 6 ) && ( parent._flags |= X_Node_State.IE4_TEXTNODE_FIX ); }); console.log( 'X.Dom.Builder' );