Skip to main content

Bug Tracker

Side navigation

#11793 closed bug (duplicate)

Opened May 21, 2012 09:03AM UTC

Closed May 21, 2012 03:44PM UTC

Last modified May 22, 2012 08:26PM UTC

trigger('change') on a disabled input do not trigger filtered listener .on('change', 'input', ...)

Reported by: pierre.gotab@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Let $input be a disabled input in a $form.

A call to $input.trigger('change') wont fire a listener set up with $form.on('change', 'input', function(){...}) but will fire a listener set up with $form.on('change', function(){...}).

Here: http://jsfiddle.net/LAuBz/

Attachments (0)
Change History (4)

Changed May 21, 2012 03:44PM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

Changed May 21, 2012 03:44PM UTC by dmethvin comment:2

Duplicate of #11382.

Changed May 22, 2012 07:57PM UTC by anonymous comment:3

What I understand from the duplicate state is that jQuery is consistent with the (incredibly retarded) fact that some browsers do not trigger some events on disabled inputs (mouse events and - apparently - change events).

But a listener set on a parent can catch the 'change' event so this event is actually created and bubbled?!

Finally, t seems like:

.on(type, selector, function)

is different from:

.on(type, function(evt){ if(!$(evt.target).is(selector)) return; ... })

in this situation.

Not a really clear behavior... and not documented in http://api.jquery.com/on/

Besides, the W3C never said that events don't fire on disabled inputs, and the note at the end of http://www.w3.org/TR/html4/interact/forms.html#h-17.12.1 let us think that scripts can operate on disabled inputs and therefore events should fire and bubble normally. I hope jQuery goal is not to conform to creepy browser's implementations but to offer to the javascript programmer a smart interface to that crap. Thank you for your work btw :)

Changed May 22, 2012 08:26PM UTC by dmethvin comment:4

If you want to contribute, please don't post on duplicate tickets. You can see the duplicate is assigned, right? None of this comment adds anything to useful discussion on that ticket so please don't add it there.