blob: 3787a0148ce7c895be0fc454551569ca4488b8b4 (
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
|
---
title: DocumentFragment.querySelectorAll()
slug: Web/API/DocumentFragment/querySelectorAll
tags:
- API
- DOM
- DocumentFragment
- メソッド
browser-compat: api.DocumentFragment.querySelectorAll
translation_of: Web/API/DocumentFragment/querySelectorAll
---
{{ApiRef("DOM")}}
**`DocumentFragment.querySelectorAll()`** メソッドは {{domxref("NodeList")}} で、 {{domxref("DocumentFragment")}} の中で指定されたセレクター群に一致する要素の一覧を(文書ノードの深さ優先前順走査 (depth-first pre-order traversal) を使用して)返します。
引数で指定されたセレクターが無効であった場合、 {{domxref("DOMException")}} が `SYNTAX_ERR` の値で発生します。
## 構文
```js
elementList = documentfragment.querySelectorAll(selectors);
```
### 引数
- _selectors_
- : {{domxref("DOMString")}} で、1 つ以上の CSS セレクターをカンマで区切って指定します。
## 例
この例は、 `DocumentFragment` の中にあるすべての `div` 要素のうち、 "`note`" または "`alert`" クラスのついたものすべてのリストを返します。
```js
var matches = documentfrag.querySelectorAll("div.note, div.alert");
```
## 仕様書
{{Specifications}}
## ブラウザーの互換性
{{Compat}}
## 関連情報
- 所属する {{domxref("DocumentFragment")}} インターフェイス
|