X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=4c7b07eca87226591d2c87de4e75ab8f2e65911f;hb=715d1c5a30cc4986018bbf063713f14c34c3e258;hp=7543b8cf67f07284e5ee442635608f0bdffda2d9;hpb=04524287d3e0112deae570ff9247c734833431bb;p=jquery.git diff --git a/src/core.js b/src/core.js index 7543b8c..4c7b07e 100644 --- a/src/core.js +++ b/src/core.js @@ -444,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; } @@ -481,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 ); @@ -567,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; },