youse guys are cookin! (that's good)

what about generalizing the if else if else if else case into
choose(
".this', thiscallback"
             ," that", thatcallback,otherwisecallback)

Mmmmm

On 10/2/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> Brandon Aaron schrieb:
> > What I mean by changing the behavior of the is method is this ... The
> > is method returns true or false based on the condition. What will the
> > return value be if you pass in a function or two functions for
> > if/else? Would it still return true/false or the actual unchanged
> > jQuery object? Same question applies for the not method suggestion ...
> > Would it return a modified jQuery object or an unmodified one when
> > functions are passed?
> >
> You are right: While adding paramters to a method is ok, changing the
> return type is not.
> >> This avoids the anonymous functions, but it's use is limited to jQuery
> >> methods.
> >>
> > So I think maybe I missed the goal of the $else construct. It seems
> > its purpose is to provide a way to apply only jQuery methods. I can
> > see the benefit of this but still really dislike the name since it is
> > a keyword. Maybe name it 'otherwise'.
> >
> I thought about otherwise, too. I changed it to else$ lately, but that
> is stupid, too.
> > I still think providing a method named 'ifelse' that takes an
> > expression and two methods or maybe even one. I could see this being
> > very useful and flexible. The 'ifelse' method would return the jQuery
> > object unmodified.
> >
> I like that. You could then use it like this:
> $(...).ifelse(':visible', ifCallback).doOtherStuff();
> $(...).ifelse(':visible', ifCallback, elseCallback).doOtherStuff();
> $(...).ifelse(':visible', null, elseCallback).doOtherStuff();
>
> I'll put that in, if noone objects :-)
>
> -- Jörn
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░
▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░
▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to