Bug 15259 - CustomEvent initCustomEvent
CustomEvent initCustomEvent
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: DOM
unspecified
PC Windows NT
: P2 normal
: ---
Assigned To: Anne
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-18 04:25 UTC by Brandon Slade
Modified: 2012-11-28 14:31 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Slade 2011-12-18 04:25:08 UTC
In the DOM4 specification, the interface of CustomEvent (found at http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#customevent) contains only one member: "readonly attribute any detail;" The DOM3EVENTS specification declares one more method overload, "initCustomEvent(DOMString type, bool bubbles, bool cancelable, any detail);". (This can be found at http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-CustomEvent)

I know that the initEvent method is made obsolete due to the fact that in DOM3 you are introducing Event constructors, but as long as they're not actually depreciated, shouldn't you keep them simply for backwards-compatibility? At the very least, shouldn't you keep initCustomEvent for the same reason that you are keeping initEvent, or if you need to get rid of one, then unify the change and get rid of both?
Comment 1 Ms2ger 2011-12-18 09:13:50 UTC
The reason that we're keeping initEvent is compatibility with deployed content (prototype.js, for example: <https://github.com/sstephenson/prototype/blob/master/src/prototype/dom/event.js#L956>); I rather doubt that reason applies as much to initCustomEvent.
Comment 2 Dominic Cooney 2011-12-26 05:56:32 UTC
(In reply to comment #1)
> The reason that we're keeping initEvent is compatibility with deployed content
> …
> I rather doubt that reason applies as much to initCustomEvent.

A couple of smaller frameworks use initCustomEvent:

<http://codesearch.google.com/#search/&q=initCustomEvent%5B%5Es%5D%20lang:js&type=cs>

eg "JSDOM", "Ample" and "XBL" (an XBL2-in-JavaScript implementation.)

I’m not sure if these are sufficient justification for keeping initCustomEvent around or not. However it is more use than other init*Event (eg initProgressEvent) methods get (at least in the indexable, open source space.)
Comment 3 Anne 2011-12-29 13:49:17 UTC
Lets keep this open until we know it has been removed from some implementations.
Comment 4 Anne 2012-11-28 14:31:56 UTC
Okay, it's back in:

http://dom.spec.whatwg.org/
https://github.com/whatwg/dom/commit/5b575eec760d842d3d9dfe23650eb486854c6c39

Dominic, your name will be added to the acknowledgments next checkin as I forgot it this time.