Closed 8176135 closed 5 years ago
For a one-line fix I suspect it would be more efficient to collect
the elements to remove into a Vec
before removing any (compared to running select
repeatedly).
Better still would be a custom iterator (for example, if an element is to be removed there is no need to look at its descendants since they would be removed from the original tree with it), but that’s more work to build.
I didn't realize you could save css_match
into a Vec
and then delete it that way, it works for me, thanks!
How to remove every element matching a css-selector? Currently if I
detach()
a node in theselect()
loop, it just stops. i.e.Do I have to keep running
select
until all instances are removed?