Closed Bug 867418 Opened 11 years ago Closed 11 years ago

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

Categories

(Core :: DOM: Events, defect)

23 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 329509

People

(Reporter: andy.mozilla-bugzilla, Unassigned)

Details

Attachments

(1 file)

Attached file 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'.
Attachment #743878 - Attachment mime type: text/plain → text/html
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: