causal-agent / scraper

HTML parsing and querying with CSS selectors
https://docs.rs/scraper
ISC License
1.81k stars 100 forks source link

NodeRef<Node> to ElementRef so that it can be selected from? #93

Closed raine closed 1 year ago

raine commented 1 year ago

Hey! For the life of me I can't figure out how to select from children of a ElementRef.

for node in elem.children() {
   // node is type of `NodeRef<Node>` and has no select method, nor does there appear to be anyway to make an `ElementRef` out of it.
}

Any ideas? Thanks!

causal-agent commented 1 year ago

https://docs.rs/scraper/latest/scraper/element_ref/struct.ElementRef.html#method.wrap

raine commented 1 year ago

Thanks! wrap ended up working after all.