jquery core: fixed makeArray to recognize the window (has length)

test runner: updated the tests for makeArray
This commit is contained in:
Ariel Flesler 2008-04-25 03:48:07 +00:00
parent 25f9974cee
commit 508b1e2432
2 changed files with 15 additions and 9 deletions

View file

@ -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;
},