I like that a lot. On Fri, Oct 3, 2008 at 4:11 PM, Yehuda Katz <[EMAIL PROTECTED]> wrote:
> Part of the problem here is that it adds a LOT of additional complexity to > what is currently a very simple and easy to understand API. It might not > seem that way to us, as developers, but to new developers, they'd have to > understand a new $.self construct when they're still struggling to grasp > "this" and closures. > What about something like: > > $("#foo").fadeOut("normal").andThen("remove", arguments), where andThen > would be implemented as attaching a callback to the previous operation. This > would require normalizing the notion of callbacks across operations, but it > might work, no? > > -- Yehuda > > On Fri, Oct 3, 2008 at 10:50 AM, John Resig <[EMAIL PROTECTED]> wrote: > >> >> > I agree with you, just wanted to through some ideas into the mix, but >> > do you agree that this is "unelegant code" >> > >> > $('#foo').fadeOut('normal',function(){ $(this).remove(); }); >> > >> > Do you have any suggestions to improve it? I think the last option I >> > provided is the most realistic and I think that making it clear that >> > you may only apply a single jquery method without arguments is within >> > reason. It is just a shortcut, and you can use a whole function >> > wrapper if you want to do something else. >> >> One idea that I had was a special jQuery object that produces a >> wrapped function, something like: >> >> $("#foo").fadeOut("normal", jQuery.self.remove()); >> >> More complicated: >> >> $("#foo").fadeOut("normal", >> jQuery.self.hide("fast", >> jQuery.self.remove())); >> >> That wouldn't be "that hard" to implement (imo) - any interest? I >> could probably code something up if there is. >> >> --John >> >> >> > > > -- > Yehuda Katz > Developer | Engine Yard > (ph) 718.877.1325 > > > > -- Ariel Flesler http://flesler.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---