Hello,
we're using Tapestry for a big web application and are currently converting over to jQuery. Tapestry uses prototype but it's possible to eliminate that and replace it with prototype. Anyways, a lot of times we heavily rely on the order of the event handler being called. One example is if we open multiple modal dialogs, using the tab key we want to only focus on the elements of the foremost dialog. In prototype we simply unregistered available handlers, registered our new handler (as the first registered runs first), and reregistered the old handlers. Another example would be when we want to prevent clicking links, Tapestry registers a handle on each clickable/accessible elements and throws a custom event, to prevent anything from happening we also need to ensure the correct order. We never liked that solution but couldn't come up with any better one. With jQuery it's a bit easier as we can simply resort the data('events') array. Still, the solution doesn't really seem to be too elegant. Another problem i see coming is with delegate/on as the handler isn't necessarily registered on the element itself but somewhere above in the DOM hierarchy. Would be great if anyone could give me a hint on how to solve those problems. Except enforcing (asking) developers to only register the event handlers on certain elements (e.g.body) so we reliably can find them again i couldn't think of anything.
kind regards
Matt