blob: a5fc005a4b9bb2ccc1908ff99ac001b5f5ad9499 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
---
title: DocumentFragment.querySelectorAll()
slug: Web/API/DocumentFragment/querySelectorAll
tags:
- API
- DOM
- DocumentFragment
- Method
browser-compat: api.DocumentFragment.querySelectorAll
---
{{ApiRef("DOM")}}
The **`DocumentFragment.querySelectorAll()`** method returns a
{{domxref("NodeList")}} of elements within the {{domxref("DocumentFragment")}} (using
depth-first pre-order traversal of the document's nodes) that matches the specified
group of selectors.
If the selectors specified in parameter are invalid a {{domxref("DOMException")}} with
a `SYNTAX_ERR` value is raised.
## Syntax
```js
elementList = documentfragment.querySelectorAll(selectors);
```
### Parameters
- _selectors_
- : Is a {{domxref("DOMString")}} containing one or more CSS selectors separated by
commas.
## Examples
This example returns a list of all `div` elements within the
`DocumentFragment` with a class of either "`note`" or
"`alert`":
```js
var matches = documentfrag.querySelectorAll("div.note, div.alert");
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- The {{domxref("DocumentFragment")}} interface it belongs to.
|