Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11145 closed bug (fixed)

$(document).on() not working with name="disabled"

Reported by: stevene Owned by: gibson042
Priority: low Milestone: 1.7.2
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


If a form includes an element with a name attribute of 'disabled', the .on function does not prevent the form from being submitted (when used with a descendant selector).

This form is not prevented from submitting:

<form action="google.com">
    <input type="text" name="disabled" value="Some text" />
    <input type="submit" />
$(document).on('submit', 'form', false);

If the name of the text input was changed to anything other than 'disabled' the form is prevented from submitting.

Strangely, if I change the method to the following, the original form would not submit (even with the name="disabled" attribute)

$('form').on('submit', false);

Example: Two identical forms, one with name="disabled" http://jsfiddle.net/y3HVA/

Note: I am not trying to disable this field, I simply wanted to use the name 'disabled' as the attribute.

Change History (5)

comment:1 Changed 11 years ago by gibson042

Confirmed. To fix #6911, jquery.event.dispatch delegate handler processing requires !event.target.disabled. In this case, both event.target and event.target.disabled are elements... the former a form and the latter a contained input.

I recommend we instead require event.target.disabled !== true.

comment:3 Changed 11 years ago by dmethvin

Owner: set to gibson042
Status: newassigned

Thanks gibson042, I'll land this soon!

comment:4 Changed 11 years ago by Richard Gibson

Resolution: fixed
Status: assignedclosed

Fix #11145: Harden dispatch against a form-aliased "disabled" property

Changeset: 77de76b942bf6bde5cf17ddad15b03049c92e6be

comment:5 Changed 11 years ago by dmethvin

Component: unfiledevent
Milestone: None1.7.2
Priority: undecidedlow
Note: See TracTickets for help on using tickets.