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

Do array types have public interface objects?

From: David Flanagan <dflanagan@mozilla.com>
Date: Mon, 20 Jun 2011 10:39:18 -0700
Message-ID: <4DFF85C6.5030805@mozilla.com>
To: public-script-coord@w3.org
The WebIDL draft specifies that an array type such as Attr[] (used by 
the DOM Core Element.attributes attribute) has the name "AttrArray" but 
it doesn't seem to require that there be an AttrArray interface object 
in the global scope as it does for regular interfaces.

On the other hand, instances of AttrArray don't inherit directly from 
Array.protoype.  Instead there is an array host object prototype object 
on the inheritance chain before Array.prototype. This suggests to me 
that perhaps the intent (not yet codified in the spec) is that this 
prototype object should be accessible as AttrArray.prototype.

As it stands now, if you want to define a property to be inherited by 
AttrArrays (and only AttrArrays) you'd have to first obtain an instance 
of AttrArray and use Object.getPrototypeOf() on it, which seems awkward.

If individual array types can be individually monkeypatched, then I 
think they deserve a public interface object.  On the other hand, if 
they don't have a public interface object, then wouldn't it be simpler 
to have them inherit directly from Array.prototype?

Received on Monday, 20 June 2011 17:39:48 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:44 UTC