files/en-us/web/api/documentfragment/queryselectorall/index.md
{{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.
querySelectorAll(selectors)
selectors
A non-live {{domxref("NodeList")}} containing one {{domxref("Element")}} object for each element that matches at least one of the specified selectors or an empty {{domxref("NodeList")}} in case of no matches.
This example returns a list of all div elements within the
DocumentFragment with a class of either note or
alert:
const matches = documentFrag.querySelectorAll("div.note, div.alert");
{{Specifications}}
{{Compat}}