Skip to content

Commit

Permalink
document.all: explain replacement (mdn#28234)
Browse files Browse the repository at this point in the history
  • Loading branch information
skissane authored Jul 28, 2023
1 parent 9c1ffea commit fc01d4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions files/en-us/web/api/document/all/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ property returns an {{DOMxRef("HTMLAllCollection")}} rooted at the document node
other words, it returns all of the document's elements, accessible by order (like an
array) and by ID (like a regular object).

Rather than using `document.all` to return an {{DOMxRef("HTMLAllCollection")}} of all the document's elements in document order, you can use {{DOMxRef("Document.querySelectorAll")}} to return a {{DOMxRef("NodeList")}} of all the document's elements in document order:

```js
const allElements = document.querySelectorAll("*");
```

## Value

An {{DOMxRef("HTMLAllCollection")}} which contains every element in the document.
Expand Down

0 comments on commit fc01d4b

Please sign in to comment.