Closed Kayxue closed 11 months ago
@Kayxue hi, if you use a match statement here could help.
What error message do you get?
children()
returns an iterator that produces NodeRef
s -- if the child represents an element (eg if child.value().is_element()
is true) then you can covert it into an ElementRef
with ElementRef::wrap(child)
(which returns Option<ElementRef>
). If you just needed an Element
then child.value().as_element()
will get you there.
(Commenting because I was struggling with this, but have since figured it out through source reading.)
Amazing, thank you @iarna!
I want to select an element from a child node, what should I do? Seems that this way doesn't work.