pub type Node<'a> = NodeRef<'a, NodeData>;
Expand description
Alias for NodeRef
.
Aliased Type§
pub struct Node<'a> {
pub id: NodeId,
pub tree: &'a Tree<NodeData>,
}
Fields§
§id: NodeId
§tree: &'a Tree<NodeData>
Implementations§
Source§impl<'a> Node<'a>
impl<'a> Node<'a>
pub fn next_element_sibling(&self) -> Option<Node<'a>>
pub fn prev_element_sibling(&self) -> Option<Node<'a>>
Source§impl<'a> Node<'a>
impl<'a> Node<'a>
pub fn node_name(&self) -> Option<StrTendril>
pub fn has_class(&self, class: &str) -> bool
pub fn add_class(&self, class: &str)
pub fn remove_class(&self, class: &str)
pub fn attr(&self, name: &str) -> Option<StrTendril>
pub fn attrs(&self) -> Vec<Attribute>
pub fn set_attr(&self, name: &str, val: &str)
pub fn remove_attr(&self, name: &str)
Source§impl<'a> Node<'a>
impl<'a> Node<'a>
pub fn is_document(&self) -> bool
pub fn is_element(&self) -> bool
pub fn is_text(&self) -> bool
Source§impl<'a> Node<'a>
impl<'a> Node<'a>
pub fn html(&self) -> StrTendril
pub fn text(&self) -> StrTendril
Trait Implementations§
Source§impl<'a> Element for Node<'a>
impl<'a> Element for Node<'a>
type Impl = InnerSelector
Source§fn opaque(&self) -> OpaqueElement
fn opaque(&self) -> OpaqueElement
Converts self into an opaque representation.
fn parent_element(&self) -> Option<Self>
Source§fn parent_node_is_shadow_root(&self) -> bool
fn parent_node_is_shadow_root(&self) -> bool
Whether the parent node of this element is a shadow root.
Source§fn containing_shadow_host(&self) -> Option<Self>
fn containing_shadow_host(&self) -> Option<Self>
The host of the containing shadow root, if any.
Source§fn is_pseudo_element(&self) -> bool
fn is_pseudo_element(&self) -> bool
Whether we’re matching on a pseudo-element.
Source§fn prev_sibling_element(&self) -> Option<Self>
fn prev_sibling_element(&self) -> Option<Self>
Skips non-element nodes
Source§fn next_sibling_element(&self) -> Option<Self>
fn next_sibling_element(&self) -> Option<Self>
Skips non-element nodes
fn is_html_element_in_html_document(&self) -> bool
fn has_local_name( &self, local_name: &<Self::Impl as SelectorImpl>::BorrowedLocalName, ) -> bool
Source§fn has_namespace(
&self,
ns: &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl,
) -> bool
fn has_namespace( &self, ns: &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl, ) -> bool
Empty string for no namespace
Source§fn is_same_type(&self, other: &Self) -> bool
fn is_same_type(&self, other: &Self) -> bool
Whether this element and the
other
element have the same local name and namespace.fn attr_matches( &self, ns: &NamespaceConstraint<&<Self::Impl as SelectorImpl>::NamespaceUrl>, local_name: &<Self::Impl as SelectorImpl>::LocalName, operation: &AttrSelectorOperation<&<Self::Impl as SelectorImpl>::AttrValue>, ) -> bool
fn match_non_ts_pseudo_class<F>(
&self,
_pc: &<Self::Impl as SelectorImpl>::NonTSPseudoClass,
_context: &mut MatchingContext<'_, Self::Impl>,
_flags_setter: &mut F,
) -> boolwhere
F: FnMut(&Self, ElementSelectorFlags),
fn match_pseudo_element( &self, _pe: &<Self::Impl as SelectorImpl>::PseudoElement, _context: &mut MatchingContext<'_, Self::Impl>, ) -> bool
Source§fn is_html_slot_element(&self) -> bool
fn is_html_slot_element(&self) -> bool
Returns whether the element is an HTML element.
fn has_id( &self, name: &<Self::Impl as SelectorImpl>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool
fn has_class( &self, name: &<Self::Impl as SelectorImpl>::ClassName, case_sensitivity: CaseSensitivity, ) -> bool
Source§fn exported_part(
&self,
_name: &<Self::Impl as SelectorImpl>::PartName,
) -> Option<<Self::Impl as SelectorImpl>::PartName>
fn exported_part( &self, _name: &<Self::Impl as SelectorImpl>::PartName, ) -> Option<<Self::Impl as SelectorImpl>::PartName>
Returns the mapping from the
exportparts
attribute in the regular
direction, that is, inner-tree -> outer-tree.Source§fn imported_part(
&self,
_name: &<Self::Impl as SelectorImpl>::PartName,
) -> Option<<Self::Impl as SelectorImpl>::PartName>
fn imported_part( &self, _name: &<Self::Impl as SelectorImpl>::PartName, ) -> Option<<Self::Impl as SelectorImpl>::PartName>
Returns the mapping from the
exportparts
attribute in the reverse
direction, that is, in an outer-tree -> inner-tree direction.fn is_part(&self, _name: &<Self::Impl as SelectorImpl>::PartName) -> bool
Source§fn is_root(&self) -> bool
fn is_root(&self) -> bool
Returns whether this element matches
: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>
The parent of a given pseudo-element, after matching a pseudo-element
selector. Read more
Source§fn assigned_slot(&self) -> Option<Self>
fn assigned_slot(&self) -> Option<Self>
Returns the assigned element this element is assigned to. Read more
Source§fn ignores_nth_child_selectors(&self) -> bool
fn ignores_nth_child_selectors(&self) -> bool
Returns whether this element should ignore matching nth child
selector.