For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface NodeList

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

MDN Reference

interface NodeList {
    length: number;
    "[iterator]"(): ArrayIterator<Node>;
    entries(): ArrayIterator<[number, Node]>;
    forEach(
        callbackfn: (value: Node, key: number, parent: NodeList) => void,
        thisArg?: any,
    ): void;
    item(index: number): Node | null;
    keys(): ArrayIterator<number>;
    values(): ArrayIterator<Node>;
    [index: number]: Node;
}

Hierarchy (View Summary)

Indexable

  • [index: number]: Node
Index
length: number

The NodeList.length property returns the number of items in a NodeList.

MDN Reference

  • Parameters

    • callbackfn: (value: Node, key: number, parent: NodeList) => void
    • OptionalthisArg: any

    Returns void

  • 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.

    MDN Reference

    Parameters

    • index: number

    Returns Node | null

Was this helpful?