X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=4c7b07eca87226591d2c87de4e75ab8f2e65911f;hb=715d1c5a30cc4986018bbf063713f14c34c3e258;hp=90040f2b3667511c830af607c06e65f3f88fa08a;hpb=9d8bd161b6548b33fe6c834a65bb1733c07ea29c;p=jquery.git diff --git a/src/core.js b/src/core.js index 90040f2..4c7b07e 100644 --- a/src/core.js +++ b/src/core.js @@ -1,9 +1,7 @@ // Define a local copy of jQuery var jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' - return arguments.length === 0 ? - rootjQuery : - new jQuery.fn.init( selector, context ); + return new jQuery.fn.init( selector, context ); }, // Map over jQuery in case of overwrite @@ -446,8 +444,8 @@ jQuery.extend({ // not own constructor property must be Object if ( obj.constructor - && !hasOwnProperty.call(obj, "constructor") - && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { + && !hasOwnProperty.call(obj, "constructor") + && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } @@ -483,7 +481,7 @@ jQuery.extend({ script.text = data; } - // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); @@ -569,23 +567,20 @@ jQuery.extend({ }, merge: function( first, second ) { - var pos, i = second.length; + var i = first.length, j = 0; - // We have to get length this way when IE & Opera overwrite the length - // expando of getElementsByTagName - if ( i && i.nodeType ) { - for ( i = 0; second[i]; ++i ) {} - } - - pos = i + first.length; - - // Correct length for non Arrays - first.length = pos; - - while ( i ) { - first[ --pos ] = second[ --i ]; + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } } + first.length = i; + return first; },