NodeList
NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().
Extended by
Indexable
[index: number]: Node
Methods
[iterator]()
iterator: ArrayIterator<Node>;
Returns
entries()
entries(): ArrayIterator<[number, Node]>;
Returns an array of key, value pairs for every entry in the list.
Returns
ArrayIterator<[number, Node]>
forEach()
forEach(callbackfn, thisArg?): void;
Parameters
| Parameter | Type |
|---|---|
callbackfn | (value, key, parent) => void |
thisArg? | any |
Returns
void
item()
item(index): Node | null;
Returns a node from a NodeList by index. This method doesn't throw exceptions as long as you provide arguments. A value of null is returned if the index is out of range, and a TypeError is thrown if no argument is provided.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
Node | null
keys()
keys(): ArrayIterator<number>;
Returns an list of keys in the list.
Returns
ArrayIterator<number>
values()
values(): ArrayIterator<Node>;
Returns an list of values in the list.
Returns
Properties
length
readonly length: number;
The NodeList.length property returns the number of items in a NodeList.