NodeList
A NodeList is a specialized
subclass of Array that is expressly
designed with some fantastic extensions for manipulating collections
of DOM nodes with ease. One of the more seductive features of a
NodeList is its ability to provide
chaining via the dot operator, although many specialized capabilities
such as mapping, filtering, and looking up the index of a node exist
as well.
Table 5-2 provides an overview of the
NodeList methods available. These
methods are named according to the very same convention as Base's
Array functions. The only caveats
are that they return NodeLists
instead of Arrays.
Tip
For a review of the fundamentals involving the following Array manipulations, see the section "Array Processing" in Chapter 2.
Table 5-2. NodeList methods
Name | Comment |
|---|---|
[a] | |
| Returns the first
location of an item in the |
| Returns the last
location of an item in the |
| Returns true if the
function returns true for every item in the |
| Returns true if the
function returns true for at least one item in the |
| Runs each item through
a function and returns the original |
| Runs each item through
a function and returns the results as a |
| Runs each item through
a |
| Returns a ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access