I think jQuery figured out a solution for this — care to do some research, Mislav?
Cheers, Andrew On Apr 23, 2010, at 12:45 PM, Mislav Marohnić wrote: > The "submit" event doesn't bubble up in Internet Explorer after it originates > in a form. That makes it impossible to catch with event delegation: > > document.on("submit", function(e) { ... }) > > > Kangax wrote about a way we can detect even support without browser sniffing: > http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ > We have good custom events support, so we should be able to emulate submit > event bubbling in IE. There are a couple of approaches: > > > 1) Stick a real "submit" handler directly on each form and make it fire a > custom "submit" event on the form's parent: > > > $$('form').invoke('observe', 'submit', ...) > > > Pros: easy. > Cons: doesn't work with dynamically created (or inserted) forms, making this > solution too brittle. > > > 2) Forms can be submitted in two ways: clicking/tapping one of the submit > buttons, or pressing Enter. Both of these events bubble, so we can detect > where the submit originated from and fire a custom event from there. > > > Pros: works with dynamically created forms. > Cons: potentially complex solution. Unnecessary observing of all clicks and > keypresses on the page? > > > 3) Observe when a form element gains focus with "focusin" event, then stick a > real submit handler to it which in turn fires the custom event. > > > Pros: less complex than click/keypress. > Cons: not sure if it's possible to submit a form without triggering a > "focusin" event first, but if it is then this solution is brittle. > > > > > I'll do more testing later. But right now, what are your opinions? Do you > have any other ideas how we could hook into forms on the page and trigger > custom "submit" events? > > -- > You received this message because you are subscribed to the Google Groups > "Prototype: Core" group. > To post to this group, send email to prototype-core@googlegroups.com > To unsubscribe from this group, send email to > prototype-core-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/prototype-core?hl=en -- You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en