Changeset 4206
- Timestamp:
- 12/17/07 16:54:44 (8 months ago)
- Location:
- trunk/jquery
- Files:
-
- 2 modified
-
src/core.js (modified) (1 diff)
-
test/unit/core.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jquery/src/core.js
r4196 r4206 354 354 355 355 return this.filter(function() { 356 return jQuery.inArray( this, selector ) < 0; 356 // check to see if the selector is array-like otherwise assume it is just a DOM element 357 return ( selector.length && selector[selector.length - 1] !== undefined ) 358 ? jQuery.inArray( this, selector ) < 0 359 : this != selector; 357 360 }); 358 361 }, -
trunk/jquery/test/unit/core.js
r4196 r4206 1059 1059 1060 1060 test("not()", function() { 1061 expect( 5);1061 expect(7); 1062 1062 ok( $("#main > p#ap > a").not("#google").length == 2, "not('selector')" ); 1063 ok( $("#main > p#ap > a").not(document.getElementById("google")).length == 2, "not(DOMElement)" ); 1063 1064 isSet( $("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" ); 1064 1065 isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" ); 1065 1066 isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" ); 1067 ok( $("p").not(document.getElementsByTagName("p")).length == 0, "not(Array-like DOM collection)" ); 1066 1068 isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')"); 1067 1069 });