]> source.dussan.org Git - jquery.git/commitdiff
Fixed #2070 by adding a test for !nodeType to isArrayLike so DOM elements like SELECT...
authorDavid Serduke <davidserduke@gmail.com>
Mon, 17 Dec 2007 21:02:05 +0000 (21:02 +0000)
committerDavid Serduke <davidserduke@gmail.com>
Mon, 17 Dec 2007 21:02:05 +0000 (21:02 +0000)
src/core.js
test/unit/core.js

index 1ec8de057ffbf38fb93dd46c98e83541a8e2cc13..1e4f92490d69c2c5c1ff9cee9d42f43eb0271d24 100644 (file)
@@ -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;
                });
        },
 
index 170be21c39aeb6f4f5a413f6a7ae870426e02463..6b2c3fe33f43eb1107f75bbd8ca7f46c3c2888ab 100644 (file)
@@ -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() {