Commit f8e5fd6f authored by Jörn Zaefferer's avatar Jörn Zaefferer

jquery core: Patch from #2619 applied, making makeArray more flexible and...

jquery core: Patch from #2619 applied, making makeArray more flexible and faster; removed hint to ticket from (previously failing) test
parent f12d94a6
...@@ -1123,12 +1123,13 @@ jQuery.extend({ ...@@ -1123,12 +1123,13 @@ jQuery.extend({
makeArray: function( array ) { makeArray: function( array ) {
var ret = []; var ret = [];
// Need to use typeof to fight Safari childNodes crashes if( array != undefined )
if ( array.constructor != Array ) //strings and functions also have 'length'
for ( var i = 0, length = array.length; i < length; i++ ) if( array.length != undefined && !array.split && !array.call )
ret.push( array[ i ] ); for( var i = array.length; i; )
else ret[--i] = array[i];
ret = array.slice( 0 ); else
ret[0] = array;
return ret; return ret;
}, },
......
...@@ -1562,7 +1562,7 @@ test("contents()", function() { ...@@ -1562,7 +1562,7 @@ test("contents()", function() {
equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" ); 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); expect(11);
equals( $.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" ); equals( $.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment