dispatchEvent does not dispatch events on disabled form controls (sometimes throws error?)

RESOLVED DUPLICATE of bug 329509

Status

()

Core
DOM: Events
RESOLVED DUPLICATE of bug 329509
5 years ago
5 years ago

People

(Reporter: Andy Smith, Unassigned)

Tracking

23 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Created attachment 743878 [details]
Test case

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31

Steps to reproduce:

Call 'dispatchEvent' on a disabled form control element, using a custom
event created with 'document.createEvent'.

See attached test case, which uses a disabled 'button' element. I've
observed the same behaviour with disabled 'input' (text and file) and
'select' elements. It also occurs when the element is disabled because
it's in a disabled 'fieldset' rather than through its own 'disabled'
attribute.

Tested in a Firefox nightly build (23.0a1, 2013-04-30), running in
GNU/Linux (Intel, 64-bit).



Actual results:

Event listeners registered on the element are not called. (They are
called if the element is not disabled; visible in the attached test case
with a console message).

'dispatchEvent' returns true. Previously (in Iceweasel 20) I've seen it
throw an error:

   Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED)
   [nsIDOMEventTarget.dispatchEvent]

but I can't currently reproduce this, in the Firefox nightly build or
Iceweasel 20.



Expected results:

Event listeners should be called. I think.

According to http://www.w3.org/TR/html5/forms.html#enabling-and-disabling-form-controls :

   A form control that is disabled must prevent any click events that
   are queued on the user interaction task source from being dispatched
   on the element.

But there is no mention of events other than 'click', and by my reading
synthetic 'click' events should be allowed since they're not from the
user interaction task source.

Behaviour in other browsers:

- Chromium 26 and Opera 12.15 (both GNU/Linux): event listeners are
  called even when the element is disabled.

- Internet Explorer 9 (Windows): event listeners are not called when the
  element is disabled through its own 'disabled' attribute, but they are
  called if the element is inside a disabled 'fieldset'.

Updated

5 years ago
Attachment #743878 - Attachment mime type: text/plain → text/html
Dupe of bug 329509?

Updated

5 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 329509
You need to log in before you can comment on or make changes to this bug.