[whatwg/dom] document.createEvent() supports lots of events that most UAs do not support initializers for (#362)

The current whitelist of event names for document.createEvent() is based on events that at least two of Chrome, Firefox, Safari, Edge support.  However, when generating the list, I didn't test whether they support a corresponding init*Event() method on the interface.  Without that, support in createEvent() seems pointless.  Here's a new test that lists not only what interfaces are supported by document.createEvent(), but what init methods are found:

https://jsfiddle.net/s53w679y/1/

The result is that a lot of them are supported with an initializer only in Edge, and supported without an initializer in Chrome (and in a few cases Edge as well).  To wit, all of the following are unsupported in Firefox and Safari, and are supported in Chrome but without an initializer method:

* AnimationEvent
* CloseEvent
* ErrorEvent
* FocusEvent
* IDBVersionChangeEvent (Edge also has no initializer)
* PageTransitionEvent (Edge also has no initializer)
* ProgressEvent
* TrackEvent (Edge also has no initializer)
* TransitionEvent 
* WebGLContextEvent (Edge also has no initializer)

And similarly:

* PopStateEvent: Supported by Chrome and Firefox with no special initializer.  Not supported by Safari.  Supported by Edge with a special initializer.
* SVGZoomEvent: Supported by Firefox with no special initializer.  Not supported at all by other browsers.
* SVGZoomEvents: Supported by Firefox, Safari, and Edge with no special initializer.  Not supported by Chrome.

I suggest all of these be removed from the spec, unless we think pages really use events that they can't initialize.  Maybe they use the default values for all the properties?  In some cases there are still initializers like initUIEvent from base classes.

@domenic, do you know why Chrome supports so many event types from createEvent() even though it has no initializer?  Would you have a problem with not supporting these in createEvent() anymore?

@bzbarsky, do you know why Gecko supports SVGZoomEvent(s) from createEvent() even though it has no initializer?  

@khuey In <https://hg.mozilla.org/mozilla-central/rev/1f60138bce8d>, why did you leave PopStateEvent support in createEvent but removed the initializer?  Just to match Chrome?  It looks like <https://bugzilla.mozilla.org/show_bug.cgi?id=1031051#c33> asked to remove it, but you didn't.

A couple of other event types that are interesting:

* BeforeUnloadEvent: Supported by Chrome and Firefox with no special initializer.  Not supported by Safari or Edge.  But this is not supposed to have any special initializer per spec, so that's fine.
* WheelEvent: Supported in both Edge and Safari with an initializer, but they're named differently (initWheelEvent vs. initWebKitWheelEvent).  Chrome has only initMouseEvent.  Firefox doesn't support it at all.  I don't know if we need to keep this in the spec.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/362

Received on Tuesday, 1 November 2016 16:56:39 UTC