feeling optimistic, i went ahead and filed a ticket with a patch. :) http://dev.jquery.com/ticket/4994
On Wed, Jul 29, 2009 at 2:09 PM, Nathan Bubna<nbu...@gmail.com> wrote: > On Wed, Jul 29, 2009 at 2:08 PM, Nathan Bubna<nbu...@gmail.com> wrote: >> As far as the main jQuery code goes, yes, load() is the single use >> case. But i'd also use this for >> http://plugins.jquery.com/project/rest which has >> Create/Read/Update/Delete methods that can be called on elements. >> >> What i hope to do is have element-specific loading >> (http://plugins.jquery.com/project/loading) messages that are >> triggered automatically by load (et al) methods called on those >> elements. >> >> I'd assumed it could be done, but was surprised to find all my ajax >> event handlers called regardless of what event i was calling load() >> and the like upon. Imagine if you noticed that when component A on a >> page made an ajax call, it caused the loading message for totally >> unrelated component B to display. :) > > er... totally unrelated in my head, obviously they share jQuery.cache. :) > >> The stack overflow code was just a simplified example. You're right >> that there are other ways to achieve such ends, but i'd still argue it >> is unintuitive for $('#a').load('foo') to trigger ajax events on >> $('#b'). That was probably incredibly useful before jQuery had >> bubbling for custom events, but now it seems wrong to me. >> >> On Wed, Jul 29, 2009 at 12:09 PM, John Resig<jere...@gmail.com> wrote: >>> Well, this only really makes sense for the .load() event, right? >>> Perhaps I'm missing something, but in the code that you posted >>> to Stack Overflow you could've done: >>> >>> $(e.target).load('foobar', onajax); >>> >>> And just not used .ajaxStart() at all. >>> --John >>> >>> >>> On Wed, Jul 29, 2009 at 2:55 PM, Nathan Bubna <nbu...@gmail.com> wrote: >>>> >>>> <div id="a"></div> >>>> <div id="b"></div> >>>> $('#b').ajaxStart(function(e) { console.log('ajax started! and the >>>> target was '+e.target+'?!?'); }); >>>> $('#a').load('foo'); >>>> >>>> This was really unintuitive and surprising to me. Given the way ajax >>>> events are triggered currently, there is no way to distinguish what >>>> element the load() call happened on. This creates limitations for >>>> both my current application and my plugins (namely, loading and rest). >>>> >>>> I would love to have a 'target' option for $.ajax calls that would >>>> cause the ajax events to be triggered as normal, bubbling custom >>>> events on the specified target element, rather than always be global. >>>> And of course, i think load() should pass the target option by >>>> default. >>>> >>>> Does that make sense? Would that break too many things? I'm willing >>>> to file the bug and patch, but i wanted feedback, particularly to see >>>> if i was missing some key reason for things being the way they are >>>> first. >>>> >>>> This came out of here: >>>> >>>> http://stackoverflow.com/questions/1201512/jquery-ajax-events-called-on-every-element-in-the-page-when-only-targeted-at-one/1202235#1202235 >>>> which was also posted here: >>>> >>>> http://groups.google.com/group/jquery-en/browse_thread/thread/6613a7f4972600b6 >>>> >>>> >>> >>> >>> >>> >>> >> > --~--~---------~--~----~------------~-------~--~----~ 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 jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---