Struct accessibility_rs::ElementRef
source · pub struct ElementRef<'a> { /* private fields */ }Expand description
Wrapper around a reference to an element node.
This wrapper implements the Element trait from the selectors crate, which allows it to be
matched against CSS selectors.
Implementations§
source§impl<'a> ElementRef<'a>
impl<'a> ElementRef<'a>
sourcepub fn wrap(node: NodeRef<'a, Node>) -> Option<ElementRef<'a>>
pub fn wrap(node: NodeRef<'a, Node>) -> Option<ElementRef<'a>>
Wraps a NodeRef only if it references a Node::Element.
sourcepub fn select<'b>(&self, selector: &'b Selector) -> Select<'a, 'b>
pub fn select<'b>(&self, selector: &'b Selector) -> Select<'a, 'b>
Returns an iterator over descendent elements matching a selector.
sourcepub fn inner_html(&self) -> String
pub fn inner_html(&self) -> String
Returns the inner HTML of this element.
Methods from Deref<Target = NodeRef<'a, Node>>§
sourcepub fn prev_sibling(&self) -> Option<NodeRef<'a, T>>
pub fn prev_sibling(&self) -> Option<NodeRef<'a, T>>
Returns the previous sibling of this node.
sourcepub fn next_sibling(&self) -> Option<NodeRef<'a, T>>
pub fn next_sibling(&self) -> Option<NodeRef<'a, T>>
Returns the next sibling of this node.
sourcepub fn first_child(&self) -> Option<NodeRef<'a, T>>
pub fn first_child(&self) -> Option<NodeRef<'a, T>>
Returns the first child of this node.
sourcepub fn last_child(&self) -> Option<NodeRef<'a, T>>
pub fn last_child(&self) -> Option<NodeRef<'a, T>>
Returns the last child of this node.
sourcepub fn has_siblings(&self) -> bool
pub fn has_siblings(&self) -> bool
Returns true if this node has siblings.
sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Returns true if this node has children.
sourcepub fn prev_siblings(&self) -> PrevSiblings<'a, T>
pub fn prev_siblings(&self) -> PrevSiblings<'a, T>
Returns an iterator over previous siblings.
sourcepub fn next_siblings(&self) -> NextSiblings<'a, T>
pub fn next_siblings(&self) -> NextSiblings<'a, T>
Returns an iterator over next siblings.
sourcepub fn first_children(&self) -> FirstChildren<'a, T>
pub fn first_children(&self) -> FirstChildren<'a, T>
Returns an iterator over first children.
sourcepub fn last_children(&self) -> LastChildren<'a, T>
pub fn last_children(&self) -> LastChildren<'a, T>
Returns an iterator over last children.
sourcepub fn traverse(&self) -> Traverse<'a, T>
pub fn traverse(&self) -> Traverse<'a, T>
Returns an iterator which traverses the subtree starting at this node.
sourcepub fn descendants(&self) -> Descendants<'a, T>
pub fn descendants(&self) -> Descendants<'a, T>
Returns an iterator over this node and its descendants.
Trait Implementations§
source§impl<'a> Clone for ElementRef<'a>
impl<'a> Clone for ElementRef<'a>
source§fn clone(&self) -> ElementRef<'a>
fn clone(&self) -> ElementRef<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<'a> Debug for ElementRef<'a>
impl<'a> Debug for ElementRef<'a>
source§impl<'a> Element for ElementRef<'a>
impl<'a> Element for ElementRef<'a>
Note: will never match against non-tree-structure pseudo-classes.
type Impl = Simple
fn local_name( &self ) -> &<<ElementRef<'a> as Element>::Impl as SelectorImpl>::BorrowedLocalName
source§fn namespace(&self) -> &Atom<NamespaceStaticSet>
fn namespace(&self) -> &Atom<NamespaceStaticSet>
source§fn opaque(&self) -> OpaqueElement
fn opaque(&self) -> OpaqueElement
fn parent_element(&self) -> Option<ElementRef<'a>>
source§fn parent_node_is_shadow_root(&self) -> bool
fn parent_node_is_shadow_root(&self) -> bool
source§fn containing_shadow_host(&self) -> Option<ElementRef<'a>>
fn containing_shadow_host(&self) -> Option<ElementRef<'a>>
source§fn prev_sibling_element(&self) -> Option<ElementRef<'a>>
fn prev_sibling_element(&self) -> Option<ElementRef<'a>>
source§fn next_sibling_element(&self) -> Option<ElementRef<'a>>
fn next_sibling_element(&self) -> Option<ElementRef<'a>>
fn is_html_element_in_html_document(&self) -> bool
fn attr_matches( &self, ns: &NamespaceConstraint<&Atom<NamespaceStaticSet>>, local_name: &CssLocalName, operation: &AttrSelectorOperation<&CssString> ) -> bool
fn match_non_ts_pseudo_class<F>( &self, pseudo_class: &NonTSPseudoClass, _context: &mut MatchingContext<'_, <ElementRef<'a> as Element>::Impl>, _flags_setter: &mut F ) -> bool
fn match_pseudo_element( &self, _pe: &PseudoElement, _context: &mut MatchingContext<'_, <ElementRef<'a> as Element>::Impl> ) -> bool
source§fn is_html_slot_element(&self) -> bool
fn is_html_slot_element(&self) -> bool
fn has_id(&self, id: &CssLocalName, case_sensitivity: CaseSensitivity) -> bool
fn has_class( &self, name: &CssLocalName, case_sensitivity: CaseSensitivity ) -> bool
source§fn is_root(&self) -> bool
fn is_root(&self) -> bool
:root,
i.e. whether it is the root element of a document. Read moresource§fn pseudo_element_originating_element(&self) -> Option<Self>
fn pseudo_element_originating_element(&self) -> Option<Self>
source§fn assigned_slot(&self) -> Option<Self>
fn assigned_slot(&self) -> Option<Self>
source§fn ignores_nth_child_selectors(&self) -> bool
fn ignores_nth_child_selectors(&self) -> bool
source§impl<'a> PartialEq for ElementRef<'a>
impl<'a> PartialEq for ElementRef<'a>
source§fn eq(&self, other: &ElementRef<'a>) -> bool
fn eq(&self, other: &ElementRef<'a>) -> bool
self and other values to be equal, and is used
by ==.source§impl<'a> Serialize for ElementRef<'a>
impl<'a> Serialize for ElementRef<'a>
source§fn serialize<S>(
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<(), Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<(), Error>where
S: Serializer,
source§impl<'a> Deref for ElementRef<'a>
impl<'a> Deref for ElementRef<'a>
impl<'a> Copy for ElementRef<'a>
impl<'a> Eq for ElementRef<'a>
impl<'a> StructuralEq for ElementRef<'a>
impl<'a> StructuralPartialEq for ElementRef<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ElementRef<'a>
impl<'a> !Send for ElementRef<'a>
impl<'a> !Sync for ElementRef<'a>
impl<'a> Unpin for ElementRef<'a>
impl<'a> !UnwindSafe for ElementRef<'a>
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.