Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Web IDL: W3C Language Bindings for DOM Specifications Gets a New Name

Web IDL: W3C Language Bindings for DOM Specifications Gets a New Name

This item in japanese

The W3C Web Applications Working Group recently published the working draft of Web IDL which was formerly known as the Language Bindings for DOM Specifications. The working draft defines a syntactic subset of OMG IDL version 3.0 for use by specifications that define interfaces. InfoQ spoke to the specification editor to learn more about the specification and its impact on the Web development community.

The interface definition language defined by the working draft is called Web IDL which can be used to describe interfaces that are intended to be implemented in web browsers. Web IDL is an IDL variant with a number of features that allow the behavior of common script objects in the web platform to be specified more readily. A number of extensions are given to theIDL to support common functionality that previously must have been written in prose. In addition, precise language bindings for ECMAScript 3rd Edition and Java are given. The Introduction part of the document explains the reason for having such a specification:
Technical reports published by the W3C that include programming language interfaces have typically been described using the Object Management Group’s Interface Definition Language (IDL) [OMGIDL]. The IDL provides a means to describe these interfaces in a language independent manner. Usually, additional language binding appendices are included in such documents which detail how the interfaces described with theIDL correspond to constructs in the given language.

However, the bindings in these specifications for the language most commonly used on the web, ECMAScript, are consistently specified with low enough precision as to result in interoperability issues. In addition, each specification must describe the same basic information, such as DOM interfaces described inIDL corresponding to properties on the ECMAScript global object, or the unsigned long IDL type mapping to the Number type in ECMAScript.
Web IDL is intended to specify in detail the language used by W3C specifications to define interfaces, and to provide precise conformance requirements for ECMAScript and Java bindings of such interfaces.
It is expected that the document acts as a guide to implementors of already-published specifications, and that newly published specifications reference this document to ensure conforming implementations of interfaces are interoperable. "It is proving unbelievably helpful in the construction of HTML5." says Ian Hickson, one of the HTML 5 editors. And another specification that will reference Web IDL is XMLHttpRequest Level 2, which was first published in February 25 this year.

Besides some changes in the content, a major change made in this revision is that the title of the document is changed to "Web IDL", which is "a more accurate name for what the document defines (an IDL language and its mapping to two languages), as the document’s previous name gives people an impression that it was applicable only to DOM specifications, not any specification defining an interface with IDL," according to Cameron McCormack, the editor of Web IDL.

Cameron also tells InfoQ how Web IDL would be useful for the Web development community indirectly:
Most DOM-related specifications at the moment have quite high level descriptions of how host objects in ECMAScript that implement particular interfaces should behave. For example, the ECMAScript Language Binding appendix of DOM Level 3 Core describes the ECMAScript binding for DOM Level 3 Core, yet it does not say that Node prototype object is in the prototype chain for an Element object. Various AJAX toolkits rely on this, yet it has not been standardised.

Another example is that it’s not explained how types are coerced when calling functions on host objects. For example, when you do:

circleElement.setAttributeNS(null, 'cx', 2 * 50);

then it’s expected that this behaves like:

circleElement.setAttributeNS(null, 'cx', '100');

since the third argument to setAttributeNS() is a DOMString. This isn’t defined anywhere, but it is widely interoperable behaviour. Web IDL defines how type coercion works like this.
So with Web IDL "imposing stricter requirements on language bindings for other specifications", the Web development community will see a more interoperable world as far as the coherence between standards and between products developed against the same standards is concerned.

Rate this Article