I'm not crazy about the .filter()/.$else() as presented for one reason: It calls .end() as part of its implementation. Most programmers will expect to have to call .end() themselves, and it will be a bit confusing if it doesn't have to be explicitly called in this case. In fact, I don't think that people will expect the object returned by .$else(), which is the result of the .not() in the implementation (that they didn't call explicitly). The object that .$else() returns should be the original object returned by .filter() . That ends up being the making the most sense, I think. Agree?
- Brian > Brandon Aaron schrieb: >> ** Going to re-read to make sure I'm not complete off-base ** >> >> Okay ... so after re-reading I think that Jörn's first idea is the >> better one than the other suggestions. My only concern is that it >> changes the behavior of the is method. I still think making this its >> own method is the best option. >> >> With that said I think either modifying the is method, not method or >> *preferably* adding a new method with this simple syntax will be very >> useful! >> > The modification to is() won't break any existing code that uses is() as > documented (with only one paramter). > But before closing this topic: Could you please have a look at the other > solution to this: http://jquery.com/discuss/2006-October/012969/ > This avoids the anonymous functions, but it's use is limited to jQuery > methods. > > -- Jörn > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
