Skip to content
Permalink
Browse files
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.
  • Loading branch information
jeresig committed Jul 5, 2006
1 parent 3811ac4 commit 9b6df19cc4dcc03760aee8a6df95a0d3c8585780
Showing 1 changed file with 9 additions and 1 deletion.
@@ -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 ?

0 comments on commit 9b6df19

Please sign in to comment.