Clarification on "live NodeList"

http://dev.w3.org/html5/spec/Overview.html#dom-document-getelementsbyname
http://dev.w3.org/html5/spec/Overview.html#dom-document-getelementsbyclassname

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."

and

"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"

Regards,
Jeff Schiller

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