Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10844 closed bug (fixed)

.delegate() on submit doesn't work when form contains input with name "id"

Reported by: tarmaq Owned by: dmethvin
Priority: blocker Milestone: 1.7.1
Component: event Version: 1.7
Keywords: Cc:
Blocked by: Blocking:


If I create submit handler via .delegate() or .on() function, the selector is the id of the form, form contains input named="id", handler is't called after submitting..


  $('body').delegate('#myForm', 'submit', function()

This works:

    <form id="myForm">
      <input type="submit" value="Submit" />

This doesn't work:

    <form id="myForm">
      <input name="id" type="hidden" value="foo" />
      <input type="submit" value="Submit" />

The same issue when using .on() function.

Change History (5)

comment:1 Changed 12 years ago by dmethvin

Resolution: cantfix
Status: newclosed

There is no easy way to fix this and it's not specific to jQuery. Bowsers alias the form input names on the form element. You can use this tool to avoid such conflicts.


comment:2 Changed 12 years ago by tarmaq

But this was working with jQuery v1.6.4, after upgrading to v1.7 it's broken.

comment:3 Changed 12 years ago by dmethvin

Component: unfiledevent
Milestone: None1.7.1
Priority: undecidedblocker
Resolution: cantfix
Status: closedreopened

You're right, this is a regression because it used to go through Sizzle. So I'll put the same fix into the delegate testing.

comment:4 Changed 12 years ago by dmethvin

Owner: set to dmethvin
Status: reopenedassigned

comment:5 Changed 12 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Fix #10844. Harden quickIs() against form-aliasing of the id property.

Changeset: 8cb065addc13a8042523b6db4bfd1d80a33c9a46

Note: See TracTickets for help on using tickets.