};
this[ '_flags' ] |= X_NodeFlags_EXIST;
X_Node_CHASHE[ this[ '_uid' ] = uid ] = this;
-
- X_EventDispatcher_systemListen( this, X_EVENT_BEFORE_KILL_INSTANCE, X_Node_onBeforeKill );
},
'width' : X_Node_width,
var xnode, xnodes, i, l;
if( this[ '_tag' ] ){
X_Node_newByTag = true;
- xnode = Node( this[ '_tag' ], X_Object_clone( this[ '_attrs' ] ), X_Object_clone( this[ '_css' ] ) )
+ xnode = Node( this[ '_tag' ], X_Object_copy( this[ '_attrs' ] ), X_Object_copy( this[ '_css' ] ) )
[ 'attr' ]( { 'id' : this[ '_id' ] } )
[ 'className' ]( this[ '_className' ] );
if( opt_clone_children && ( xnodes = this[ '_xnodes' ] ) && ( l = xnodes.length ) ){
return this;
};
-function X_Node_onBeforeKill( e ){
- var xnodes = this[ '_xnodes' ], i, elm;
+function X_Node_onKill( that ){
+ var parent = that.parent,
+ xnodes = that[ '_xnodes' ], i, elm;
- if( ( this[ '_flags' ] & X_NodeFlags_EXIST ) === 0 ) return X_Callback_NONE;
+ if( ( that[ '_flags' ] & X_NodeFlags_EXIST ) === 0 ) return;
- elm = this[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( this );
- elm && this[ '_listeners' ] && X_EventDispatcher_unlistenAll( this ); // イベントの退避
+ parent && parent[ '_xnodes' ].splice( parent[ '_xnodes' ].indexOf( that ), 1 );
+
+ elm = that[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( that );
+ // elm && that[ '_listeners' ] && X_EventDispatcher_unlistenAll( that ); // イベントの退避
if( xnodes && ( i = xnodes.length ) ){
for( ; i; ){
- X_Node_onBeforeKill.call( xnodes[ --i ] );
+ xnodes[ --i ][ 'kill' ]();
};
};
- delete X_Node_CHASHE[ this[ '_uid' ] ];
-
- if( e ){
- this[ 'remove' ]();
- if( X_Node_reserveRemoval[ X_Node_reserveRemoval.length - 1 ] === this ){
- this[ '_flags' ] &= ~X_NodeFlags_EXIST;
- return X_Callback_PREVENT_DEFAULT;
- };
+ delete X_Node_CHASHE[ that[ '_uid' ] ];
+// remove _xnodes
+ if( X_UA_DOM.IE4 ){
+ if( elm ){
+ X_Node_reserveRemoval[ X_Node_reserveRemoval.length ] = elm;
+ X_Node_reserveUpdate();
+ } else
+ if( !that[ '_tag' ] && ( parent[ '_flags' ] & X_NodeFlags_IE4_FIXED ) === 0 ){
+ parent[ '_flags' ] |= X_NodeFlags_IE4_DIRTY_CHILDREN;
+ };
+ } else {
+ if( elm && elm.parentNode && elm.parentNode.tagName ){
+ X_Node_reserveRemoval[ X_Node_reserveRemoval.length ] = elm;
+ X_Node_reserveUpdate();
+ };
};
- return X_Callback_NONE;
};
+
+
/**
* 要素を子以下に持つか?調べる。
* @alias Node.prototype.contains
*/
function X_Node_call( name /*, opt_args... */ ){
var l = arguments.length - 1,
- raw, func, args, params, i;
+ v, raw, func, args, params, i;
switch( name ){
case 'nodeType' :
func = raw[ name ];
if( X_Type_isFunction( func ) ){
if( l ){
- args = X_Object_cloneArray( arguments );
+ args = X_Array_copy( arguments );
args.shift();
return func.apply( raw, args );
};
return raw[ name ]();
} else
- if( X_Type_isUnknown( func ) ){
+ if( X_Type_isUnknown( func ) || ( X_UA[ 'IE' ] < 9 && X_Type_isObject( func ) ) ){
// typeof func === unknown に対策
// http://la.ma.la/blog/diary_200509031529.htm
if( l ){
- args = X_Object_cloneArray( arguments );
+ args = X_Array_copy( arguments );
args.shift();
params = [];
function X_Node_each( func /*, opt_args */ ){
var args;
if( 1 < arguments.length ){
- args = X_Object_cloneArray( arguments );
+ args = X_Array_copy( arguments );
args[ 0 ] = 0;
func.apply( this, args );
} else {
var X_Node_updateReservedByReleaseGPU = false;
function X_Node_startUpdate( time ){
- var removal, i, xnode;
+ var removal, i, xnodeOrElm;
if( !X_Node_updateTimerID || X_ViewPort_readyState < X_EVENT_INIT ){
return;
if( i = removal.length ){
for( ; i; ){
- xnode = removal[ --i ];
+ xnodeOrElm = removal[ --i ];
// TODO GPU レイヤーの子の場合、remove をスキップする。 非GPU レイヤーへ apppend される場合、clone する?
- X_Node__actualRemove( xnode );
- ( xnode[ '_flags' ] & X_NodeFlags_EXIST ) === 0 && xnode[ 'kill' ]();
+ if( !xnodeOrElm[ 'instanceOf' ] ){
+ if( X_UA_DOM.IE4 ){
+ xnodeOrElm.removeAttribute( 'id' ); // ?
+ xnodeOrElm.outerHTML = ''; // xnodeOrElm.remove() ?
+ } else {
+ if( !X_UA[ 'MacIE' ] ){
+ // elm.parentNode.tagName for ie7
+ xnodeOrElm.parentNode && xnodeOrElm.parentNode.tagName && xnodeOrElm.parentNode.removeChild( xnodeOrElm );
+ } else {
+ xnodeOrElm.parentNode && xnodeOrElm.parentNode.tagName && X_TEMP._fixed_remove( xnodeOrElm, that );
+ };
+ };
+ } else {
+ X_Node__actualRemove( xnodeOrElm );
+ };
};
removal.length = 0;
};
switch( that[ '_tag' ] + k ){
case 'TEXTAREAvalue' :
// IETester 5.5 ではエラーが出なかった.MultipulIE5.5 ではエラーが出たので
- if( !X_UA[ 'MacIE' ] && X_UA[ 'IE5x' ] ){
+ // MultipleIE6 でもここを通す。X_UA[ 'ieExeComError' ] の場合 MultipleIE6
+ if( ( !X_UA[ 'MacIE' ] && X_UA[ 'IE5x' ] ) || ( X_UA[ 'ieExeComError' ] && X_UA[ 'IE6' ] ) ){
elm.firstChild ?
( elm.firstChild.data = v || '' ) :
elm.appendChild( document.createTextNode( v || '' ) );
elm.removeAttribute( 'id' ); // ?
//document.all[ that[ '_id' ] || ( 'ie4uid' + that[ '_uid' ] ) ] = null; // MacIE5 でエラー
- if( !isChild ) elm.outerHTML = '';
+ if( !isChild ) elm.outerHTML = ''; // elm.remove() ?
delete that[ '_rawObject' ];
}) :
(function(){});