Fixed an issue with .not("#foo, bar") not working correctly, closes #3757.

This commit is contained in:
John Resig 2008-12-31 19:21:24 +00:00
parent c7a14f1391
commit 6a3d1a1e28
2 changed files with 6 additions and 2 deletions

View file

@ -24,7 +24,7 @@ var jQuery = window.jQuery = window.$ = function( selector, context ) {
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
// Is it a simple selector // Is it a simple selector
isSimple = /^.[^:#\[\.]*$/, isSimple = /^.[^:#\[\.,]*$/,
// Will speed up references to undefined, and allows munging its name. // Will speed up references to undefined, and allows munging its name.
undefined; undefined;

View file

@ -1345,7 +1345,7 @@ test("closest()", function() {
}); });
test("not()", function() { test("not()", function() {
expect(8); expect(11);
equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" ); equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" );
equals( jQuery("#main > p#ap > a").not(document.getElementById("google")).length, 2, "not(DOMElement)" ); equals( jQuery("#main > p#ap > a").not(document.getElementById("google")).length, 2, "not(DOMElement)" );
isSet( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" ); isSet( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
@ -1356,6 +1356,10 @@ test("not()", function() {
var selects = jQuery("#form select"); var selects = jQuery("#form select");
isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element"); isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element");
isSet( jQuery('#ap *').not('code'), q("google", "groups", "anchor1", "mark"), "not('tag selector')" );
isSet( jQuery('#ap *').not('code, #mark'), q("google", "groups", "anchor1"), "not('tag, ID selector')" );
isSet( jQuery('#ap *').not('#mark, code'), q("google", "groups", "anchor1"), "not('ID, tag selector')");
}); });
test("andSelf()", function() { test("andSelf()", function() {