#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: |
Description
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..
Example:
$('body').delegate('#myForm', 'submit', function() { alert('works!'); });
This works:
<body> <form id="myForm"> <input type="submit" value="Submit" /> </form> </body>
This doesn't work:
<body> <form id="myForm"> <input name="id" type="hidden" value="foo" /> <input type="submit" value="Submit" /> </form> </body>
The same issue when using .on() function.
Change History (5)
comment:1 Changed 12 years ago by
Resolution: | → cantfix |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
But this was working with jQuery v1.6.4, after upgrading to v1.7 it's broken.
comment:3 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Milestone: | None → 1.7.1 |
Priority: | undecided → blocker |
Resolution: | cantfix |
Status: | closed → reopened |
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
Owner: | set to dmethvin |
---|---|
Status: | reopened → assigned |
comment:5 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #10844. Harden quickIs() against form-aliasing of the id property.
Changeset: 8cb065addc13a8042523b6db4bfd1d80a33c9a46
Note: See
TracTickets for help on using
tickets.
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.
http://kangax.github.com/domlint/