Fix #14313: Optimize jQuery.merge for size. Close gh-1344.

This commit is contained in:
Amey Sakhadeo 2013-08-28 22:24:55 +05:30 committed by Richard Gibson
parent 83396ba832
commit c75c9a8ebb

View File

@ -552,18 +552,14 @@ jQuery.extend({
}, },
merge: function( first, second ) { merge: function( first, second ) {
var l = second.length, var l = +second.length,
i = first.length, i = first.length,
j = 0; j = 0;
if ( typeof l === "number" ) { if ( l ) {
for ( ; j < l; j++ ) { for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ]; first[ i++ ] = second[ j ];
} }
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
} }
first.length = i; first.length = i;