Bug Tracker

Modify

Ticket #11649 (closed bug: fixed)

Opened 14 months ago

Last modified 13 months ago

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:
Blocking: Blocked by:

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:  http://jsfiddle.net/f1sherman/zUxUT/26/

Change History

comment:1 Changed 14 months ago by MoonScript <jason@…>

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.

comment:2 Changed 14 months ago by dmethvin

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to event
  • Milestone changed from None to 1.next

@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.

comment:3 Changed 14 months ago by anonymous

Proposed fix has been created here:  https://github.com/jquery/jquery/pull/771

comment:4 Changed 14 months ago by anonymous

Alternative fix proposed here:  https://github.com/jquery/jquery/pull/772

comment:5 Changed 13 months ago by Jason Moon

  • Status changed from open to closed
  • Resolution set to fixed

Fix #11649. Preserve oldIE submit flag when cloning, closes gh-772.

Changeset: e93f2a89e277d3fffbc15b4ef82ebc3ac6a840f5

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.