Commit 3c7f2af8 authored by Rick Waldron's avatar Rick Waldron

Be specific about Firefox nodes-as-nodelist. Never assume that modern browsers will "get it right".

Signed-off-by: 's avatarRick Waldron <waldron.rick@gmail.com>
parent 07a7b3e4
...@@ -919,6 +919,10 @@ function isArraylike( obj ) { ...@@ -919,6 +919,10 @@ function isArraylike( obj ) {
return false; return false;
} }
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" && return type === "array" || type !== "function" &&
( length === 0 || ( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj ); typeof length === "number" && length > 0 && ( length - 1 ) in obj );
......
...@@ -1141,7 +1141,9 @@ test("jQuery.makeArray", function(){ ...@@ -1141,7 +1141,9 @@ test("jQuery.makeArray", function(){
equal( jQuery.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" ); equal( jQuery.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" );
ok( jQuery.makeArray(document.getElementById("form")).length >= 13, "Pass makeArray a form (treat as elements)" ); // Some nodes inherit traits of nodelists
ok( jQuery.makeArray(document.getElementById("form")).length >= 13,
"Pass makeArray a form (treat as elements)" );
}); });
test("jQuery.inArray", function(){ test("jQuery.inArray", function(){
......
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