Skip to main content

Bug Tracker

Side navigation

#11145 closed bug (fixed)

Opened January 09, 2012 06:25PM UTC

Closed January 12, 2012 03:02AM UTC

Last modified January 12, 2012 03:21AM UTC

$(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:
Description

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:

#!text/html
<form action="google.com">
    <input type="text" name="disabled" value="Some text" />
    <input type="submit" />
</form>
$(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.

Attachments (0)
Change History (5)

Changed January 09, 2012 08:37PM UTC by gibson042 comment:1

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.

Changed January 11, 2012 01:54AM UTC by gibson042 comment:2

Changed January 11, 2012 03:35PM UTC by dmethvin comment:3

owner: → gibson042
status: newassigned

Thanks gibson042, I'll land this soon!

Changed January 12, 2012 03:02AM UTC by Richard Gibson comment:4

resolution: → fixed
status: assignedclosed

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

Changeset: 77de76b942bf6bde5cf17ddad15b03049c92e6be

Changed January 12, 2012 03:21AM UTC by dmethvin comment:5

component: unfiledevent
milestone: None1.7.2
priority: undecidedlow