From c96b991493b3e432fe095a18cab29b046577976c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 23 Jan 2007 10:32:41 +0000 Subject: [PATCH] Fixed not(jQuery) (need. more. tests.) --- src/jquery/coreTest.js | 5 +++-- src/jquery/jquery.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index 28ba007..a9c3e26 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -494,10 +494,11 @@ test("filter()", function() { isSet( $("p").filter(function() { return !$("a", this).length }).get(), q("sndp", "first"), "filter(Function)" ); }); -test("not(String)", function() { - expect(2); +test("not()", function() { + expect(3); ok( $("#main > p#ap > a").not("#google").length == 2, "not('selector')" ); isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" ); + isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" ); }); diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 38dee9c..19ee7c1 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -927,14 +927,14 @@ jQuery.fn = jQuery.prototype = { not: function(t) { return this.pushStack( t.constructor == String && - jQuery.multiFilter(t,this,true) || - - jQuery.grep(this,function(a){ - if ( t.constructor == Array || t.jquery ) - return jQuery.inArray( t, a ) < 0; - else - return a != t; - }) ); + jQuery.multiFilter(t, this, true) || + + jQuery.grep(this, function(a) { + return ( t.constructor == Array || t.jquery ) + ? console.log("t: %o a: %o", t, a) | jQuery.inArray( a, t ) < 0 + : a != t; + }) + ); }, /** -- 1.7.10.4