[whatwg] some comments on DOM collections

Joao Eiras joao.eiras at gmail.com
Thu Oct 19 07:22:21 PDT 2006


Anne van Kesteren <fora at annevankesteren.nl> escreveu:

> * Error handling needs to be defined for HTMLCollection.item() and
> HTMLCollection.namedItem(). What happens if there's no such indexth node
> or node with that id? This also applies to HTMLFormControlsCollection and
> HTMLOptionsCollection.

From
http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-33262535
item
   This method retrieves a node specified by ordinal index. Nodes are  
numbered in tree order (depth-first traversal order).
Parameters
   index of type unsigned long - The index of the node to be fetched. The  
index origin is 0.
Return Value
   Node - The Node at the corresponding position upon success. A value of  
null is returned if the index is out of range.


This is the best thing to do, from my multiple experiences with ecmascript.



More information about the whatwg mailing list