Khronos Public Bugzilla
Bug 550 - WebGLContextEvent should have a constructor instead of an init event
WebGLContextEvent should have a constructor instead of an init event
Status: RESOLVED FIXED
Product: WebGL
Classification: Unclassified
Component: Specification
unspecified
PC Mac OS
: P3 normal
: ---
Assigned To: 3dweb Working Group email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-09 14:53 PST by Dominic Cooney
Modified: 2011-11-11 15:19 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Cooney 2011-11-09 14:53:59 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>
Comment 1 Dominic Cooney 2011-11-09 14:54:50 PST
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;
};
Comment 2 Dominic Cooney 2011-11-09 17:03:49 PST
Note that this would mean that the WebGL spec should depend directly on the DOM 4 spec for EventInit.
Comment 3 Kenneth Russell 2011-11-11 15:19:33 PST
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.