Re: Non-constructible constructors and Arrays

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 
define...

-Boris

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