Re: [selectors-api] Liveness versus NodeList

Lachlan Hunt <lachlan.hunt@lachy.id.au> wrote:

> 
> Gavin Kistner wrote:
> > DOM Level 2 Core and DOM Level 3 Core both say:
> > "The NodeList interface provides the abstraction of an ordered
> > collection of nodes, without defining or constraining how this
> > collection is implemented. NodeList objects in the DOM are live." [1]
[2]
> >
> > " NodeList and NamedNodeMap objects in the DOM are live; that is,
> > changes to the underlying document structure are reflected in all
> > relevant NodeList and NamedNodeMap objects. For example, if a DOM user
> > gets a NodeList object containing the children of an Element, then
> > subsequently adds more children to that element (or removes children, or
> > modifies them), those changes are automatically reflected in the
> > NodeList, without further action on the user's part. Likewise, changes
> > to a Node in the tree are reflected in all references to that Node in
> > NodeListand NamedNodeMap objects." [3] [4]
> 
> This is considered to be a bug in the DOM Core specs, which will
> hopefully be fixed by Web DOM Core, which is a proposal Simon Pieters is
> working on.

You will still need a new type, as I don't see how you can possibly change
the existing behaviour so dramatically under the feet of existing content.

I would not like to lose the liveness property of node lists, as it would
make NodeList objects incredibly memory inefficient if we had to construct
the entire node list at NodeList construction time, too.


-- 
Stewart Brodie
Software Engineer
ANT Software Limited

Received on Friday, 21 November 2008 15:49:05 UTC