queryElements()function
queryElements(elements: Elements, query: Query<Element>): Iterable<Element>
| Param | Type | |
|---|---|---|
elements | Elements | The elements to walk and filter. required |
query | Query<Element> | The Query<Element> object describing the filter, sort, and limit to apply. required |
| Return | |
|---|---|
Iterable<Element> | An iterable of the matching Element objects. |
Filter elements yielded by walkElements() using a Query<Element> object.
- Supports any property query (e.g.
{ type: "tree-element" },{ type: ["tree-element", "tree-documentation"] }), sorting, limiting — anythingqueryItems()accepts.
Examples
[...queryElements(elements, { type: "br" })] // all `<br>` elements