makeArray: function( array ) {
var ret = [];
- // Need to use typeof to fight Safari childNodes crashes
- if ( array.constructor != Array )
- for ( var i = 0, length = array.length; i < length; i++ )
- ret.push( array[ i ] );
- else
- ret = array.slice( 0 );
+ if( array != undefined )
+ //strings and functions also have 'length'
+ if( array.length != undefined && !array.split && !array.call )
+ for( var i = array.length; i; )
+ ret[--i] = array[i];
+ else
+ ret[0] = array;
return ret;
},
equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
});
-test("makeArray(#2619)", function(){
+test("$.makeArray", function(){
expect(11);
equals( $.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" );