W3C home > Mailing lists > Public > public-html@w3.org > July 2009

Clarification on "live NodeList"

From: Jeff Schiller <codedread@gmail.com>
Date: Tue, 7 Jul 2009 22:35:28 -0500
Message-ID: <da131fde0907072035k638df2b9q35998b5719a99482@mail.gmail.com>
To: HTML WG <public-html@w3.org>

Both mention that it should return a "live NodeList" with the elements
that match the name/class sent to the argument.

The definition for "live" is:
http://dev.w3.org/html5/spec/Overview.html#live which says:

    "If a DOM object is said to be live, then that means that any
attributes returning that object must always return the same object
(not a new object each time), and the attributes and methods on that
object must operate on the actual underlying data, not a snapshot of
the data."

I believe the intention is that the nodes contained in the NodeList
are live (i.e. not snapshots of the nodes in the DOM).

However, "live NodeList" could also imply that the NodeList itself
should be 'live'.  That is, if a class is removed from an element in
the DOM then the NodeList object should be updated to reflect that
change by removing a node automatically.

Unless I misconstrue the intention of the spec, I would suggest
rewording the relevant portions of the spec to say:

"The getElementsByName(name) method takes a string name, and must
return a NodeList containing live references to all the HTML elements
from the document that have a name attribute whose value is equal to
the name argument (in a case-sensitive  manner), in tree order."


"When called, the method must return a NodeList containing live
references to all the elements in the document, in tree order, that
have all the classes specified in that argument, having obtained the
classes by splitting a string on spaces"

Jeff Schiller
Received on Wednesday, 8 July 2009 03:36:04 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:47 UTC