Skip to content
Permalink
Browse files

Be specific about Firefox nodes-as-nodelist. Never assume that modern…

… browsers will "get it right".

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Dec 11, 2012
1 parent 07a7b3e commit 3c7f2af81d877b24a5e5b6488e78621fcf96b265
Showing with 7 additions and 1 deletion.
  1. +4 −0 src/core.js
  2. +3 −1 test/unit/core.js
@@ -919,6 +919,10 @@ function isArraylike( obj ) {
return false;
}

if ( obj.nodeType === 1 && length ) {
return true;
}

return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
@@ -1141,7 +1141,9 @@ test("jQuery.makeArray", function(){

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(){

0 comments on commit 3c7f2af

Please sign in to comment.
You can’t perform that action at this time.