This project is archived and is in readonly mode.
rails.js on body.observe('submit',...) but submit doesn't bubble in IE
-
Bob Lail
Fixed a syntax error in the previous patch.
-
Mislav
- Tag changed from rails3 prototype ie submit todo patch event bubble to bubble, event, ie, patch, prototype, rails3, submit, unobtrusive
Hey,
This is an interesting solution, but it's too brittle. What about forms that don't have any inputs? In Rails, there could be forms that do a simple PUT or DELETE with a push of a single button, so they don't have inputs. Or did you find in your testing that form submit buttons get the "focusin" event right before the "submit" event?
-
Bob Lail
Mislav,
I'm pretty sure one of my tests was with a button_to --- and 'focusin' was fired before 'click' and 'submit'. But I'll double-check. I'll post back in a few days.
Bob
-
Mislav
In the meantime I've started a discussion on Prototype-core mailing list; we might get it into v1.7 and then ship it with Rails 3, making workarounds in here unnecessary.
-
Bob Lail
Sorry for the delay --- I finally got some free time to double-check --- the solution does work for a form containing nothing but a button in IE8 and in IE8 running "IE7 mode". I'll have to hunt for a machine that still has IE6 on it.
It does make more sense for this fix to go into Prototype. Will Prototype 1.7 ship around the same time as Rails 3?
-
Mislav
We hope so. Here's my plugin for 1.7 that I've proposed for inclusion
-
Trent Lloyd
Mislav,
Can you clarify how to test that plugin? I tried to test if it works in my application, using 1.7 and loading that js file after prototype without any luck.. sorry if I don't quite understand how to use it. Just want to confirm if this fix works as I ran into this problem.
Thanks
-
josh
- Milestone cleared.
- State changed from new to open
-
Mislav
Trent: simply loading that file after Prototype should work, yeah. The caveat is, it only changes the behavior of
Element#on, notobserve. This will work:document.on('submit', 'form#myform.fancy', function(e) { ... })This will not, because
observestill uses the plain native "submit" event which doesn't bubble in IE:document.observe('submit', function(e) { ... }) -
Jeremy Kemper
- Milestone cleared.
- Importance changed from to High
-
Mislav
- Assigned user set to josh
Just to indicate, work on this is being done in the "prototype-ujs" repo and I expect Josh Peek will merge this in core when he's satisfied with the script. It already contains the bubbling fix for IE.
-
Repository
- State changed from open to resolved
(from [f61d923d284062b4e4864d81c603157020198d06]) Update to latest rails.js
[#4411 rails.js on body.observe('submit',...) but submit doesn't bubble in IE state:resolved] http://github.com/rails/rails/commit/f61d923d284062b4e4864d81c60315...
