W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: Non-constructible constructors and Arrays

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 09 Sep 2011 14:53:44 -0400
Message-ID: <4E6A60B8.2070802@mit.edu>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: Alex Russell <slightlyoff@google.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 9/9/11 2:45 PM, Garrett Smith wrote:
>> For example, what should |new Element()| do if the specification doesn't
>> define it?
>>     There's no sane behavior, because you have no idea what tag
>> name to give it.
> Possibly HTMLUnknownElement

Which will return what, exactly, from the localName getter?

And the point is that the answer to this question cannot be defined in 
the general IDL spec.  It needs to be defined in the spec that defines 
the Element interface.  So if you want a constructor here, the spec 
defining Element needs to have explicit verbiage defining the behavior 
of that constructor.

>> You can find some examples where the behavior is "clear"... But even in
>> the |new HTMLDivElement| case, what would define what the ownerDocument
>> of the new element is?  WebIDL itself certainly can't make such a
>> definition.  The fact that an ownerDocument even exists is specific to
>> the HTMLDivElement interface, and whatever spec defines that interface
>> would need to explicitly address that.
> The global object's window's document -- window.document

Yes, but the point is that WebIDL itself can't define that!  It can't 
define the behavior of random properties on random interfaces.  The only 
thing that can define that is the spec that defines that interface.  In 
this case, the spec defining Element would need to say what the 
ownerDocument of the result is set to.

Is this really such a hard concept to grasp?  I'm getting the feeling 
that people are really confused about what WebIDL itself can define and 
what specs using WebIDL as their interface description language can 

Received on Friday, 9 September 2011 18:54:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:04 UTC