jQuery.merge( first, second ):官方文档
源码:
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
while ( j < len ) {
first[ i++ ] = second[ j++ ];
}
// Support: IE<9
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
if ( len !== len ) {
while ( second[ j ] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
}
从源码可看出,参数frist/second可以是数组或类数组对象,即必须含有整型(或可以转换为整型)属性length;
从源码可看,出 在IE<9中,会把NodeList等类数组对象的length转为NaN;