filterElements()function

filterElements(elements: Elements, match: (element: Element) => boolean): Iterable<Element>
ParamType
elementsElements
The elements to walk and filter. required
match(element: Element) => boolean
Function called with each element; return true to keep the element. required
Return
Iterable<Element>
An iterable of the matching Element objects.

Filter elements yielded by walkElements() using a match function.

Examples

[...filterElements(elements, el => el.type === "br")] // all `<br>` elements