pub trait Element:
Sized
+ Clone
+ Debug {
type Impl: SelectorImpl;
Show 26 methods
// Required methods
fn opaque(&self) -> OpaqueElement;
fn parent_element(&self) -> Option<Self>;
fn parent_node_is_shadow_root(&self) -> bool;
fn containing_shadow_host(&self) -> Option<Self>;
fn is_pseudo_element(&self) -> bool;
fn prev_sibling_element(&self) -> Option<Self>;
fn next_sibling_element(&self) -> Option<Self>;
fn is_html_element_in_html_document(&self) -> bool;
fn has_local_name(
&self,
local_name: &<Self::Impl as SelectorImpl>::BorrowedLocalName,
) -> bool;
fn has_namespace(
&self,
ns: &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl,
) -> bool;
fn is_same_type(&self, other: &Self) -> bool;
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,
) -> bool
where F: FnMut(&Self, ElementSelectorFlags);
fn match_pseudo_element(
&self,
pe: &<Self::Impl as SelectorImpl>::PseudoElement,
context: &mut MatchingContext<'_, Self::Impl>,
) -> bool;
fn is_link(&self) -> bool;
fn is_html_slot_element(&self) -> bool;
fn has_id(
&self,
id: &<Self::Impl as SelectorImpl>::Identifier,
case_sensitivity: CaseSensitivity,
) -> bool;
fn has_class(
&self,
name: &<Self::Impl as SelectorImpl>::ClassName,
case_sensitivity: CaseSensitivity,
) -> bool;
fn exported_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>;
fn is_part(&self, name: &<Self::Impl as SelectorImpl>::PartName) -> bool;
fn is_empty(&self) -> bool;
fn is_root(&self) -> bool;
// Provided methods
fn pseudo_element_originating_element(&self) -> Option<Self> { ... }
fn assigned_slot(&self) -> Option<Self> { ... }
fn ignores_nth_child_selectors(&self) -> bool { ... }
}
Required Associated Types§
type Impl: SelectorImpl
Required Methods§
sourcefn opaque(&self) -> OpaqueElement
fn opaque(&self) -> OpaqueElement
Converts self into an opaque representation.
fn parent_element(&self) -> Option<Self>
sourcefn 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.
sourcefn containing_shadow_host(&self) -> Option<Self>
fn containing_shadow_host(&self) -> Option<Self>
The host of the containing shadow root, if any.
sourcefn is_pseudo_element(&self) -> bool
fn is_pseudo_element(&self) -> bool
Whether we’re matching on a pseudo-element.
sourcefn prev_sibling_element(&self) -> Option<Self>
fn prev_sibling_element(&self) -> Option<Self>
Skips non-element nodes
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn is_html_slot_element(&self) -> bool
fn is_html_slot_element(&self) -> bool
Returns whether the element is an HTML
fn has_id( &self, id: &<Self::Impl as SelectorImpl>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool
fn has_class( &self, name: &<Self::Impl as SelectorImpl>::ClassName, case_sensitivity: CaseSensitivity, ) -> bool
sourcefn 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.
sourcefn 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
Provided Methods§
sourcefn 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.
This is guaranteed to be called in a pseudo-element.
sourcefn assigned_slot(&self) -> Option<Self>
fn assigned_slot(&self) -> Option<Self>
Returns the assigned
Necessary for the ::slotted
pseudo-class.
sourcefn ignores_nth_child_selectors(&self) -> bool
fn ignores_nth_child_selectors(&self) -> bool
Returns whether this element should ignore matching nth child selector.