Side navigation
#11649 closed bug (fixed)
Opened April 25, 2012 07:56PM UTC
Closed May 18, 2012 08:37PM UTC
delegated form submit event handler does not fire after being removed and re-added in IE7/8
Reported by: | f1sherman | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | event | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This works properly in IE9, newest stable versions of Chrome, Firefox, Safari. Does not work in IE7/8. Confirmed in jQuery 1.7.1 and 1.7.2.
See the following fiddle:
Attachments (0)
Change History (5)
Changed April 25, 2012 08:05PM UTC by comment:1
Changed April 28, 2012 05:32PM UTC by comment:2
component: | unfiled → event |
---|---|
milestone: | None → 1.next |
priority: | undecided → low |
status: | new → open |
@Moonscript, thanks for the analysis!
Your proposed solution would fix the problem, but the price would be pretty high. jQuery would have to walk the entire subtree to find any added properties or attributes. We already have to do this for .clone()
(in cloneFixAttributes
) but doing it on any DOM detach seems like a real mess. This issue is aggravated because oldIE treats properties and attributes interchangeably. If it would just clone attributes and not custom properties I don't think we'd have a problem.
Changed May 09, 2012 10:39PM UTC by comment:3
Proposed fix has been created here:
Changed May 10, 2012 03:42AM UTC by comment:4
Alternative fix proposed here:
This is happening because the form content is being retrieved via the .html() function, which includes the jQuery submit-delegation artifact on the form tag: _submit_attached="true". When that HTML string is then repopulated into the DOM, the submit event on that new form does not bubble, because it already contains the _submit_attached attribute, so jQuery skips it.
I think any jQuery-introduced markup should be stripped out when retrieved via .html(), which would solve this issue.