Skip to content
Permalink
Browse files
Fixed #2070 by adding a test for !nodeType to isArrayLike so DOM elem…
…ents like SELECT are not considered array-like (even though they really are).
  • Loading branch information
davids549 committed Dec 17, 2007
1 parent d1b9ad3 commit 24e036c7c88e7e3a1f878292e4b59914e1f4575c
Showing with 3 additions and 5 deletions.
  1. +2 −4 src/core.js
  2. +1 −1 test/unit/core.js
@@ -352,11 +352,9 @@ jQuery.fn = jQuery.prototype = {
else
selector = jQuery.multiFilter( selector, this );

var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
return this.filter(function() {
// check to see if the selector is array-like otherwise assume it is just a DOM element
return ( selector.length && selector[selector.length - 1] !== undefined )
? jQuery.inArray( this, selector ) < 0
: this != selector;
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
});
},

@@ -1068,7 +1068,7 @@ test("not()", function() {
isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')");

var selects = $("#form select");
isSet( selects.not( selects[1] ), ["select1", "select3"], "filter out DOM element");
isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element");
});

test("andSelf()", function() {

0 comments on commit 24e036c

Please sign in to comment.