jquery core: fixed makeArray to recognize the window (has length)
test runner: updated the tests for makeArray
This commit is contained in:
parent
25f9974cee
commit
508b1e2432
2 changed files with 15 additions and 9 deletions
10
src/core.js
10
src/core.js
|
@ -1114,13 +1114,15 @@ jQuery.extend({
|
|||
makeArray: function( array ) {
|
||||
var ret = [];
|
||||
|
||||
if( array != undefined )
|
||||
//strings and functions also have 'length'
|
||||
if( array.length != undefined && !array.split && !array.call )
|
||||
for( var i = array.length; i; )
|
||||
if( array != undefined ){
|
||||
var i = array.length;
|
||||
//the window, strings and functions also have 'length'
|
||||
if( i != undefined && typeof array == 'object' && array != window )
|
||||
while( i )
|
||||
ret[--i] = array[i];
|
||||
else
|
||||
ret[0] = array;
|
||||
}
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue