pub struct DomTree {
pub root: ElementNode,
pub selector_map: SelectorMap,
}Expand description
Represents the DOM tree of a web page
Fields§
§root: ElementNodeRoot element of the DOM tree
selector_map: SelectorMapMap of indices to element selectors
Implementations§
Source§impl DomTree
impl DomTree
Sourcepub fn new(root: ElementNode) -> Self
pub fn new(root: ElementNode) -> Self
Create a new empty DomTree
Sourcepub fn get_selector(&self, index: usize) -> Option<&ElementSelector>
pub fn get_selector(&self, index: usize) -> Option<&ElementSelector>
Get element selector by index
Sourcepub fn interactive_indices(&self) -> Vec<usize>
pub fn interactive_indices(&self) -> Vec<usize>
Get all interactive element indices
Sourcepub fn count_elements(&self) -> usize
pub fn count_elements(&self) -> usize
Count total elements in the tree
Sourcepub fn count_interactive(&self) -> usize
pub fn count_interactive(&self) -> usize
Count interactive elements
Sourcepub fn find_node_by_index(&self, index: usize) -> Option<&ElementNode>
pub fn find_node_by_index(&self, index: usize) -> Option<&ElementNode>
Find element node by index (traverse the tree)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DomTree
impl RefUnwindSafe for DomTree
impl Send for DomTree
impl Sync for DomTree
impl Unpin for DomTree
impl UnwindSafe for DomTree
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