HTMLCollection Interface
An HTMLCollection is a list of nodes. An individual node may be accessed by either ordinal index or the nodes name or id attribute.
IDL Definition
Interface HTMLCollection {
readonly attribute unsigned long length;
Node item(in unsigned long index);
Node namedItem(in wstring name);
};
Semantic Requirements
Basic
- An individual node may be accessed by either ordinal index, node's name or id attributes.
- Collections in the HTML DOM are assumed to be live. They are automatically updated when the underlying document is changed.
Attributes
- The length attribute specifies the length or size of the list.
Methods
- The item(index) method retrieves a node specified by ordinal index.
- Nodes are numbered in tree order (depth-first traversal order).
- The item(index) method returns null if the index is out of range.
- The namedItem(name) method retrieves a node using a name.
- The namedItem(name) method first searches for a Node with a matching id attribute.
- If no Node with a matching id attribute is found, the namedItem(name) method then searches for a node with a matching name attribute.
- If no Node is found whose id or name attributes matches the specified string, the namedItem(name) method returns null.
If you have comments or suggestions, email me at mbrady@nist.gov