From W3C Wiki
ECMAScript binding issues
This page is a collection of stuff regarding the ECMAScript DOM binding spec.
Some things to take into account
- Maciej's DOM3EV ES binding appendix rewrite
- XHR wants to have a constructor function, method overloading
- some discussion from Jonas on overloading in Mozilla
- ISSUE-23 DOM3EV: passing non-Strings to String methods
- ISSUE-24 DOM3EV: DontDelete and other internal properties
- ISSUE-27 Where can you use null
- HTMLCollection prototype issue in Mozilla's Bugzilla (bug 300519)
Differences between OMG IDL and W3C IDL
I think it'd be best to use a subset of OMG IDL. From looking a few IDL snippets on w3.org, this would be removing:
- local types
- valuetypes (except boxed valuetypes, which are used to define DOMString in DOM3Core)
- char, wchar, string, wstring, fixed_pt types
- context expressions
- out/inout parameters
- "Repository Identity Related Declarations"
- "Event Declarations"
- "Component Declarations"
- "Home Declarations"
Need arrays for <canvas> image data access.
But we now have operation overloading (e.g. as used in XHR). Do we really want this?
Why use `valuetype DOMString sequence<unsigned short>` instead of `typedef sequence<unsigned short> DOMString`? does it allow `null`?
Why use `sequence<unsigned short>` instead of `wstring`? is it because a `wchar` must be a character (and thus can't be a UTF-16 surrogate)?
We should use `getraises` and `setraises` from OMG IDL 3.0 for attribute exceptions.
W3C IDL type → ES type mapping
|`void` (for return types)|
|`unsigned long long`|
|`DOMString` (from DOM3Core)|
Need to define what happens when an "invalid" value is given for a given type (e.g. -1 for an `unsigned long`). Certain things can probably be defined in terms of ToUint32, ToObject, etc. from ecma-262.
Map- and array-like objects
Anne says Jonas thought of an idea where (static) NodeLists can have their integer properties assigned to, and the node would be replaced.
Host objects implementing interfaces
ES objects implementing interfaces
- just corresponds to ReadOnly property attribute? or should throw an exception on setting?
Feel free to fold the following into the above sections. I just wanted to jot some things down lest I forget.
It will have to define how to tell what's a constructor vs what's a method and how to handle them when they are called as the opposite of each other.
It will have to define what the prototype chain of each object should be, in terms of the browsing contexts defined in HTML5.
It will have to define what happens when you change objects in the prototype chain.
It will have to define how type coercion happens given typed parameters.
It will have to support varargs.