W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2011

[whatwg] Web DOM Core feedback

From: James Graham <jgraham@opera.com>
Date: Fri, 14 Jan 2011 11:41:49 +0100
Message-ID: <4D30286D.2050102@opera.com>
On 01/13/2011 10:05 PM, Aryeh Gregor wrote:

> In defining the interface for Node, some of the attributes are defined
> like "The parentElement attribute must return the parent node of the
> context node if there is a parent and it is an Element node, or null
> otherwise." while others are defined like
> """
> The parentNode attribute must run these steps:
>
> 1. If the context node does not have a parent node, return null and
> terminate these steps.
> 2. Return the parent node of the context node.
> """
> They seem to be equivalent, but the first way is shorter.

IMHO the second is clearer (I also note that they do not seem to be 
equivalent in this specific case).

> There are a bunch of places where it says "When invoked with the same
> argument the same NodeList object may be returned as returned by an
> earlier call."  Shouldn't this be either required or prohibited in any
> given case, not left undefined?

It seems like making this a requirement would interact badly with GC 
e.g. if I have some call that produces a huge NodeList that is then not 
referenced, I don't want to keep it around just in case some future 
script returns the same NodeList. On the other hand, there are scripts 
that put calls returning identical NodeLists in inner loops. In these 
cases not recreating the object every time is a big performance win.
Received on Friday, 14 January 2011 02:41:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC