List classes: NodeList, AttrList

Due to implementation limitations Switch is unable to return an array of Node and Attr instances. Instead, it returns a helper object of the corresponding list class, that is, NodeList and AttrList, respectively.

These helper classes offer the following functions to access the items in the list.

getCount( ) : Number

Returns the number of items in the list (may be zero).

getItem( index : Number ) : Node or Attr

Returns the item in the list at the specified (zero-based) index. If the index is out of range, the function returns null.

length : Number

This is a read-only property (rather than a function) that contains the value returned by getCount().

at( index : Number ) : Node or Attr

Returns the same value as getItem(index).