X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F02_dom%2F07_XNodeList.js;h=8e8702e15a3b9f4f7b5e7e9d4e62c4d26bf51482;hb=9ba2ba4de00464f81805b28dfcab8814a46da5e5;hp=73f3faf750fb2d10e584b437e5c58bfa3faa119e;hpb=dc5a75639232882249108b4f708916e9690e42b3;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/02_dom/07_XNodeList.js b/0.6.x/js/02_dom/07_XNodeList.js index 73f3faf..8e8702e 100644 --- a/0.6.x/js/02_dom/07_XNodeList.js +++ b/0.6.x/js/02_dom/07_XNodeList.js @@ -3,20 +3,18 @@ function X_NodeList( v ){ var args = [], l = arguments.length, i = 0, - indexOf, xnode, j, n = 0, skip; + xnode, j, n = 0, skip; + for( ; i < l; ++i ){ - //args.push( arguments[ i ] ); args.push.apply( args, arguments[ i ] ); }; - //alert( arguments[ 0 ].length + ' , ' + args.length ) + if( ( l = args.length ) === 1 ) return new Node( args[ 0 ] ); - if( !this || this.append !== X_NodeList.prototype.append ) return new X_NodeList( args ); + if( !this || this[ 'append' ] !== X_NodeList.prototype[ 'append' ] ) return new X_NodeList( args ); for( i = 0; i < l; ++i ){ xnode = args[ i ]; - //xnode = xnode && xnode.constructor === Node ? xnode : new Node( xnode ); skip = false; - if( xnode._xnodeType === 0 ) continue; for( j = 0; j < n; ++j ){ if( this[ j ] === xnode ){ skip = true; @@ -25,18 +23,18 @@ function X_NodeList( v ){ }; if( !skip ){ this[ n ] = xnode; - n = ++this.length; + n = ++this.length; }; }; }; X_NodeList.prototype.length = 0; -X_NodeList.prototype.each = function( func /* opt_args... */ ){ +X_NodeList.prototype[ 'each' ] = function( func /* opt_args... */ ){ var l = this.length, i = 0, args; if( 1 < arguments.length ){ - args = X_Object_cloneArray( arguments ); + args = X_Array_copy( arguments ); for( ; i < l; ++i ){ args[ 0 ] = i; if( func.apply( this[ i ], args ) === false ) break; @@ -55,15 +53,17 @@ X_NodeList.prototype.each = function( func /* opt_args... */ ){ X_TEMP.onSystemReady.push( function( sys ){ var target = X_NodeList.prototype, src = Node.prototype, - p, v, multi; + p, v; for( p in src ){ //if( X_EMPTY_OBJECT[ p ] ) continue; v = src[ p ]; - if( X.Type.isFunction( v ) && !target[ p ] ){ - target[ p ] = multi = new Function( [ + if( X_Type_isFunction( v ) && !target[ p ] ){ + target[ p ] = new Function( [ 'var a=arguments,f=X.Node.prototype.', p, ',t=this,i,l=t.length;', 'if(l)', - 'for(i=0;i