rstudio / htmltools

Tools for HTML generation and output
https://rstudio.github.io/htmltools/
214 stars 67 forks source link

Implement `tagQuery()$matches(fn)` #351

Open schloerke opened 1 year ago

schloerke commented 1 year ago

Fixes #350

(html <- tagList(div(), span()))
#> <div></div>
#> <span></span>
tagQ <- tagQuery(html)
tagQ$matches("span")
#> [1] FALSE TRUE
tagQ$matches(function(el, i) { el$name == "span" })
#> [1] FALSE TRUE