From: Ariel Flesler Date: Tue, 13 May 2008 02:20:08 +0000 (+0000) Subject: Closes #2510 X-Git-Tag: 1.2.4b~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=28182b43209b0e62b9ca2192671fc26644953717;p=jquery.git Closes #2510 --- diff --git a/src/core.js b/src/core.js index a0533b178..8743f05c4 100644 --- a/src/core.js +++ b/src/core.js @@ -1146,17 +1146,17 @@ jQuery.extend({ merge: function( first, second ) { // We have to loop this way because IE & Opera overwrite the length // expando of getElementsByTagName - var i = 0; + var i = 0, elem, pos = first.length; // Also, we need to make sure that the correct elements are being returned // (IE returns comment nodes in a '*' query) if ( jQuery.browser.msie ) { - for ( ; second[ i ]; i++ ) - if ( second[ i ].nodeType != 8 ) - first.push( second[ i ] ); + while ( elem = second[ i++ ] ) + if ( elem.nodeType != 8 ) + first[ pos++ ] = elem; } else - for ( ; second[ i ]; i++ ) - first.push( second[ i ] ); + while ( elem = second[ i++ ] ) + first[ pos++ ] = elem; return first; },