DocumentFragment: querySelectorAll() メソッド
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
DocumentFragment.querySelectorAll()
メソッドは NodeList
で、 DocumentFragment
の中で指定されたセレクター群に一致する要素の一覧を(文書ノードの深さ優先前順走査 (depth-first pre-order traversal) を使用して)返します。
引数で指定されたセレクターが無効であった場合、 DOMException
が SYNTAX_ERR
の値で発生します。
構文
js
querySelectorAll(selectors)
引数
selectors
-
文字列で、1 つ以上の CSS セレクターをカンマで区切って指定します。
返値
例
この例は、 DocumentFragment
の中にあるすべての div
要素のうち、 "note
" または "alert
" クラスのついたものすべてのリストを返します。
js
const matches = documentfrag.querySelectorAll("div.note, div.alert");
仕様書
Specification |
---|
DOM # ref-for-dom-parentnode-queryselectorall① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
querySelectorAll |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- 所属する
DocumentFragment
インターフェイス