Lots of improvements. Added support for .not( jQuery("...") ) and support for multi filters: .filter("foo,bar") .parent("div, .class"), etc.

This commit is contained in:
John Resig 2007-01-10 17:54:42 +00:00
parent ee0175c4b9
commit f2ff0db032
3 changed files with 61 additions and 26 deletions

View file

@ -89,6 +89,24 @@ jQuery.extend({
}
],
multiFilter: function( expr, elems, not ) {
var old, cur = [];
while ( expr && expr != old ) {
console.log( cur, expr, elems, not );
var f = jQuery.filter( expr, elems, not );
expr = f.t.replace(/^\s*,\s*/, "" );
if ( not )
cur = elems = f.r;
else
cur = jQuery.merge( cur, f.r );
}
console.log( "DONE", cur, expr, elems, not );
return cur;
},
/**
* @name $.find
* @type Array<Element>