I like this idea.  I think that it gives everyone what they want, and none
of the methods are going to be as confusing to a newcomer that way.

My one complaint is that I don't like "filterend" as a method name.  It
sounds... clunky.  I'm sure that one of us can do better.  :)

- Brian


> Hi,
>
>> I don't know, I've been using .filter( "foo", Function ) and .find(
>> "foo", Function ) for a while now and I find them to be immensely
>> useful - especially considering that they're non-destructive.
>
> Well, if it was destructive it would be more consistent. I don't think
> that it
> would be a problem, because you always have end():
>
>  $('.hideme').hide().filter('.showme').show().end().addclass('IamCrazy');
>
> is currently equivalent to
>
>  $('.hideme').hide().filter('.showme', function() {
>       $(this).show();
>  }).addclass('IamCrazy');
>
> It feels a bit odd to me. I'd expect this to be equal to the first line:
>
>  $('.hideme').hide().filter('.showme', function() {
>       $(this).show();
>  }).end().addclass('IamCrazy');
>
> The Problem arises when chaining a lot of filter(), find(), etc.
> functions.
> Then your way is IMO less readable.
>
> How about shortcut-functions for e.g. filter().end():
>
>  $.fn.filterend = function(s,c) { return this.filter(s,c).end(); }
>
>  $('.hideme').hide().filterend('.showme', function() {
>       $(this).show();
>  }).addclass('IamCrazy');
>
> I think that would be less confusing.
>
> Just my 2 cents.
>
> Christof
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to