From 9b6df19cc4dcc03760aee8a6df95a0d3c8585780 Mon Sep 17 00:00:00 2001 From: John Resig Date: Wed, 5 Jul 2006 17:12:35 +0000 Subject: [PATCH] Multi-filtering is now in place, you can do: $("div").filter(".this,.or,.that") and find all elements that match any of the three expressions. --- jquery/jquery.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jquery/jquery.js b/jquery/jquery.js index b100a054..0afafc5a 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -291,7 +291,15 @@ jQuery.fn = jQuery.prototype = { }, filter: function(t) { - return this.pushStack( jQuery.filter(t,this.cur).r ); + if ( /,/.test(t) ) { + var p = t.split(/\s*,\s*/); + return this.pushStack( $.map(this.cur,function(a){ + for ( var i = 0; i < p.length; i++ ) + if ( jQuery.filter(p[i],[a]).r.length ) + return a; + }) ); + } else + return this.pushStack( jQuery.filter(t,this.cur).r ); }, not: function(t) { return this.pushStack( t.constructor == String ?