Bugzilla – Bug 550
WebGLContextEvent should have a constructor instead of an init event
Last modified: 2011-11-11 15:19:33 PST
Recent drafts of contemporary specs—DOM4, HTML5, Workers, WebSockets, etc.—specify constructors for events instead of init methods. These are easier to read and more convenient to use because events can be created and initialized in a single expression. WebGLContextEvent should be specified this way: [Constructor(DOMString type, optional WebGLContextEventInit eventInit)] interface WebGLContextEvent : Event { readonly attribute DOMString statusMessage; void initWebGLContextEvent(DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, DOMString statusMessageArg); }; dictionary WebGLContextEventInit : EventInit { DOMString statusMessage; }; EventInit is defined in DOM4 <http://www.w3.org/TR/domcore/#eventinit>
Correction—the initWebGLContextEvent method should be removed, too: [Constructor(DOMString type, optional WebGLContextEventInit eventInit)] interface WebGLContextEvent : Event { readonly attribute DOMString statusMessage; }; dictionary WebGLContextEventInit : EventInit { DOMString statusMessage; };
Note that this would mean that the WebGL spec should depend directly on the DOM 4 spec for EventInit.
Thanks for pointing this out. Per this bug and discussion on public_webgl, have updated the editor's draft of the spec with these changes.