Skip to content

Commit 4df1c84

Browse files
add more info about NodeList (mdn#39293)
* Update index.md * Update index.md --------- Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
1 parent 0bbc834 commit 4df1c84

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

files/en-us/web/api/nodelist/index.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ Although `NodeList` is not an `Array`, it is possible to iterate over it with `f
1919

2020
Although they are both considered `NodeList` objects, there are 2 varieties of NodeList: _live_ and _static_.
2121

22-
### Live NodeLists
23-
24-
In some cases, the `NodeList` is _live_, which means that changes in the DOM automatically update the collection.
22+
In most cases, the `NodeList` is _live_, which means that changes in the DOM automatically update the collection.
2523

2624
For example, {{domxref("Node.childNodes")}} is live:
2725

@@ -33,9 +31,7 @@ parent.appendChild(document.createElement("div"));
3331
console.log(childNodes.length); // outputs "3"
3432
```
3533

36-
### Static NodeLists
37-
38-
In other cases, the `NodeList` is _static,_ where any changes in the DOM do not affect the content of the collection. The ubiquitous {{domxref("document.querySelectorAll()")}} method returns a _static_ `NodeList`.
34+
In other cases, the `NodeList` is _static,_ where any changes in the DOM do not affect the content of the collection. The ubiquitous {{domxref("document.querySelectorAll()")}} method is the only API that returns a _static_ `NodeList`.
3935

4036
It's good to keep this distinction in mind when you choose how to iterate over the items in the `NodeList`, and whether you should cache the list's `length`.
4137

0 commit comments

Comments
 (0)