All animations eventually fall into animate. We could add ids to animations and save a 'lastAnimation' attribute with the last id. Then this function adds the callback with jQuery.data, using the id withing the key.
Finally, animate (in addition to the formal callback) calls any existing callback stored with jQuery.data and clears it. Same goes for Ajax by the way. Seems totally doable to me. On Fri, Oct 3, 2008 at 4:21 PM, John Resig <[EMAIL PROTECTED]> wrote: > > Unfortunately that notion, while grammatically nice, doesn't really > play over into practical code. It would require that all animations be > modifiable after they already being initiated (and this is saying > nothing about other things with callbacks - like each, or Ajax > requests). > > --John > > > > On Fri, Oct 3, 2008 at 3:13 PM, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > 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 > > > > > > > > > > > -- 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 -~----------~----~----~----~------~----~------~--~---