pub struct Element { /* private fields */ }
Expand description
Represents a single element in the DOM tree.
Implementations§
Source§impl Element
impl Element
Sourcepub fn select_all<'a>(
&'a self,
selector: &str,
) -> Result<Box<dyn Iterator<Item = &'a Element> + 'a>, SelectError>
pub fn select_all<'a>( &'a self, selector: &str, ) -> Result<Box<dyn Iterator<Item = &'a Element> + 'a>, SelectError>
Searches the elements children for elements matching the given CSS selector.
Sourcepub fn select<'a>(&'a self, selector: &str) -> Result<&'a Element, SelectError>
pub fn select<'a>(&'a self, selector: &str) -> Result<&'a Element, SelectError>
Just like select_all
but only returns the first match.
Sourcepub fn children_iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Element> + 'a>
pub fn children_iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Element> + 'a>
Returns an iterator over the element’s direct children.
Sourcepub fn children_deep_iter<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a Element> + 'a>
pub fn children_deep_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = &'a Element> + 'a>
Returns an iterator over all the element’s children, including indirect child elements.
Sourcepub fn subtree_size(&self) -> usize
pub fn subtree_size(&self) -> usize
Returns the size of the DOM subtree, including the current element.
Sourcepub fn attr(&self, attr_name: &str) -> Option<&String>
pub fn attr(&self, attr_name: &str) -> Option<&String>
Returns the value of the element attribute if found.
Sourcepub fn matches(&self, compound_selector: &CompoundSelector) -> bool
pub fn matches(&self, compound_selector: &CompoundSelector) -> bool
Returns true if the element matches the given selector.
Sourcepub fn node_index(&self) -> usize
pub fn node_index(&self) -> usize
Returns the node index for the element.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more