Re: [selectors-api] Return an Array instead of a static NodeList

On 30/08/11 4:19 PM, Jonas Sicking wrote:
> Indeed! I think it's already been decided that all non-mutating
> functions should be added to NodeLists and other list-like DOM
> objects. I believe Cameron is still working on the specifics of that.

Shortly before the LC#2 was published, I added an [ArrayClass] extended 
attribute that you can put on interfaces that are not defined to inherit 
from another.  That causes that interface's [[Prototype]] to be 
Array.prototype instead of Object.prototype.  It's then up to the 
designer of the interface to ensure that length and array index 
properties behave usefully (by defining a length IDL attribute and using 
indexed properties) so that the Array.prototype methods will do nice things.

The other construct that uses Array.prototype is platform array objects. 
  They too have Array.prototype as their [[Prototype]].  Web IDL defines 
how array index properties and length are exposed on platform array 
objects so that they work with Array.prototype methods as best they can.

Received on Monday, 24 October 2011 18:18:32 UTC