http://stilbuero.de Klaus Hartl – Stilbüro - Klaus Hartl


Jump to: Search, Additional Information.


jQuery Delegate plugin – cross-browser submit/reset event delegation

Dan Webb has written an event delegation plugin the other day (as part of Low Pro for jQuery) – I really like his solution and as soon as you are working with Ajax page updates a lot you got to love the ease the event delegation technique provides.

There is one major drawback though. In IE submit and reset events do not bubble, thus you cannot use delegation here. Same is true for submit events in Safari 2.

In the upcoming Plazes delegation for submit/reset events turned out to be a requirement, so I wrote an event delegation plugin based on Dan Webb’s stuff, in particular on what Yehuda Katz proposed in one of the comments, and added workarounds for IE and Safari, so that you can now use delegation for these events just as you would expect. There were also some issues with using confirm().

I needed to do that quickly, thus the code could use some optimization (later).

Get it here:
http://stilbuero.de/jquery/delegate/

I just noticed that Jörn Zaefferer wrote something similar for the focus and blur events and I’m going to merge the two.

4 Comments

Comments feed

  1. I’ve also noticed that change events don’t bubble in IE (at least for select elements). Any chance you could fix those too?

    Comment by Nathan Bubna, June 27th, 2008 at 6:17 pm

  2. Hey,

    I was looking at the demo page for your new UI history plugin (which obviously is a work in progress) and I had a couple comments but couldn’t figure out how to reach you. If you care please shoot me an email.

    Thanks,
    Jeremy

    Comment by Jeremy, August 25th, 2008 at 7:19 pm

  3. Author Comment

    @Jeremy Find a rudimentary demo here: http://stilbuero.de/jquery/ui_history/

    But you named it – it is work in progress. It works in all major browsers, except that it is extremely slow in IE 6 and I couldn’t find out why yet. Please do not ask for documentation :-)

    Comment by Klaus, August 26th, 2008 at 11:00 am

  4. [...] change, etc.), you can look at the reglib code to see how they solve the problem. And also the jquery delegate plugin. [ js, code, programming, tutorial ] 1766 Latest Updates from this [...]

    Pingback by Marcyes / Event Delegation using jQuery, March 3rd, 2009 at 12:38 am



Klaus Hartl – Stilbüro is powered by WordPress, jQuery, XHTML, CSS and me.