> FYI, you can already call an extra Function argument > on any destructive operation, for example: > > .find( "foo", ifCallback ) > .filter( "foo", ifCallback ) > .not( "foo", ifCallback ) > > I didn't document this yet, since I didn't think anyone > was going to care to use it, except for me. Heh.
I use it in a few places already because of some issues with pushStack holding references to nodes that have been removed from the document: http://jquery.com/dev/bugs/bug/30/ It would still be nice to have chained operations though. Why not use the pushStack stack as an operand? For example, if you want the "else" part, just have a .invert() method that takes the current node set and selects all the nodes on the stack that aren't already in that set. $() .filter() .stuff().to().filtered().nodes() .invert() .stuff().to().remaining().nodes() .end() Yes, .invert() is destructive to the current node set, but if you need the original filtered nodes back you just invert them again. One other thing I've wanted a couple of times is a method that would add nodes only if the current node set was empty. Kind of like the "||" operator in Javascript. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/