Re: TPAC F2F DOM2 Selectors API review

On Oct 30, 2012, at 2:36 AM, Alex Russell wrote:

> Hi Everyone,
> 
> So today at TPAC there was a brief discussion about Selectors 2 -- and good news, everybody! We've settled on "find", "findAll", and "matches"!
> 
> The return type is still the issue, however, and I proposed the following today:
> 
> We specify the DOM APIs which vend node lists which must be immutable or mutated only by DOM (a.k.a. "live node lists") from existing APIs as either seal()/freeze() instances or as Proxies. That allows the vending APIs to maintain the invariants regardless of what NodeList as a class does
> We define NodeList as a constructable class which derives from Array, is mutable by default, etc.
In ES6 terms, do you mean:

class NodeList extends Array {
    constructor (...args) {
         super(...args);  //or maybe without ...args if NodeList constructor has a different  parameter interpretation
         // NodeList specific initialization such as  creating a proxy for this
      }
      //other NodeList specific methods and over-rides
}

With the assumption that "subclassing" Array and super invoking its constructor installs all Array magic such as length property invariants on the subclass instance.

Allen

Received on Tuesday, 30 October 2012 15:48:05 UTC