Path: blob/main/website/awaited-dom/HTMLCollection.md
2606 views
AwaitedDOM / HTMLCollection
The
HTMLCollection interface represents a generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list.Properties
.length W3C {#length}
Returns the number of items in the collection.
Type: Promise<number>
.length W3C {#length}
Needs content.
Type: Promise<number>
Methods
.item*(index)* W3C {#item}
Returns the specific node at the given zero-based index into the list. Returns null if the index is out of range.
Arguments:
index
number. The position of theNodeto be returned. Elements appear in anHTMLCollectionin the same order in which they appear in the document's source.
Returns: SuperElement
.namedItem*(name)* W3C {#namedItem}
Returns the specific node whose ID or, as a fallback, name matches the string specified by name. Matching by name is only done as a last resort, only in HTML, and only if the referenced element supports the name attribute. Returns null if no node exists by the given name.
Arguments:
name
string. Needs content.
Returns: SuperElement
.item*(index)* W3C {#item}
Needs content.
Arguments:
index
number. Needs content.