AwaitedDOM/ NodeList

NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().

Properties

.length
W3C

The number of nodes in the NodeList.

Type: Promise<number>

Methods

.entries()
W3C

Returns an iterator, allowing code to go through all key/value pairs contained in the collection. (In this case, the keys are numbers starting from 0 and the values are nodes.)

Returns: Promise<>

.forEach()
W3C

Executes a provided function once per NodeList element, passing the element as an argument to the function.

Returns: Promise<>

.item(index)
W3C

Returns an item in the list by its index, or null if the index is out-of-bounds.

Arguments:

  • index number. index is the index of the node to be fetched. The index is zero-based.

Returns: SuperNode

.keys()
W3C

Returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection. (In this case, the keys are numbers starting from 0.)

Returns: Promise<>

.values()
W3C

Returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.

Returns: Promise<>

Edit this page on GitHub