Closed
Bug 882165
Opened 12 years ago
Closed 2 years ago
document.createEvent('FocusEvent') is throwing
Categories
(Core :: DOM: Events, defect, P5)
Core
DOM: Events
Tracking
()
RESOLVED
DUPLICATE
of bug 1388069
People
(Reporter: erik, Unassigned)
Details
document.createEvent('FocusEvent')
is throwing
[11:33:48.888] [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NotSupportedError)" location: "debugger eval code Line: 1"]
Reporter | ||
Comment 1•12 years ago
|
||
The partial implementation in bug 855741 broke https://github.com/Polymer/ShadowDOM
Assignee: nobody → ayang
OS: Linux → All
Hardware: x86_64 → All
Version: unspecified → Trunk
Comment 2•12 years ago
|
||
Hmm, I'd say the spec (D3E) should just change.
Comment 3•12 years ago
|
||
Isn't listed here:
http://dom.spec.whatwg.org/#dom-document-createevent
Is there a particular reason you think this should be implemented?
Reporter | ||
Comment 4•12 years ago
|
||
> Is there a particular reason you think this should be implemented?(In reply to :Ms2ger from comment #3)
> Is there a particular reason you think this should be implemented?
Works in WebKit/Blink?
I'm fine fixing my code though.
Comment 5•12 years ago
|
||
If we implement that, we should update the spec instead of depending on the hidden secret of WebKit/Blink.
Reporter | ||
Comment 6•12 years ago
|
||
IE allows document.createEvent('FocusEvent') but not new FocusEvent(...).
I would not call this a hidden secret. This was the way events where create and initiated (IE even has an initFocusEvent on the FocusEvent interface.)
Still, I think not implementing this might be better since it would encourage people to start using new FocusEvent which is clearly a better API.
Feel free to close as you see fit.
Comment 7•11 years ago
|
||
This happend not only for FocusEvent. Of course constructor is modern/better but now for document.createEvent() whe have this for basic interface:
Event, CustomEvent, UIEvent, MouseEvent, KeyboardEvent, CompositionEvent << work in all browser
FocusEvent, WheelEvent << work only in Chrome and IE
*Firefox and IE are case-insensitive but Chrome is case-sensitive.
So, Firefox miss only two interface from D3E, but still support KeyboardEvent, CompositionEvent (because at now they can not be called as a constructor).
D3E allows pass any names which are supported + some legacy name:
https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-DocumentEvent-createEvent
DOM4 allows the same legacy name and including only Event, CustomEvent, UIEvent, MouseEvent:
http://dom.spec.whatwg.org/#dom-document-createevent
All this make little confusing, specifications and browser are different in the area. Not all constructors are supported, even in Firefox, like new CompositionEvent() and new KeyboardEvent(). So now we still must use old document.createEvent() for some interface and abandoning them in the future can cause next problems. Maybe all this basic interface (from D3E) should be supported?
Comment 8•11 years ago
|
||
Small correct:
Chrome support document.createEvent("FocusEvent") but missing FocusEvent.initFocusEvent, so create event in this way doesn't make any sense (we can not initialize them).
The only plus to maintain init*Event method is possibility to reinicialize event, after finish its propagation path. We can change properites of event and dispatch it again. With constructor it's impossible (we must create new event). But I don't know if this behaviour is often useful (if any).
Updated•11 years ago
|
Assignee: ayang → nobody
Comment 9•4 years ago
|
||
Bulk-downgrade of unassigned, >=3 years untouched DOM/Storage bug's priority.
If you have reason to believe this is wrong, please write a comment and ni :jstutte.
Severity: normal → S4
Priority: -- → P5
Comment 10•2 years ago
|
||
document.createEvent('FocusEvent')
no longer throws.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•