Trait selectors::tree::Element

source ·
pub trait Element: Sized + Clone + Debug {
    type Impl: SelectorImpl;

Show 30 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 first_element_child(&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( &self, pc: &<Self::Impl as SelectorImpl>::NonTSPseudoClass, context: &mut MatchingContext<'_, Self::Impl>, ) -> bool; fn match_pseudo_element( &self, pe: &<Self::Impl as SelectorImpl>::PseudoElement, context: &mut MatchingContext<'_, Self::Impl>, ) -> bool; fn apply_selector_flags(&self, flags: ElementSelectorFlags); 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>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool; fn has_custom_state( &self, name: &<Self::Impl as SelectorImpl>::Identifier, ) -> bool; fn imported_part( &self, name: &<Self::Impl as SelectorImpl>::Identifier, ) -> Option<<Self::Impl as SelectorImpl>::Identifier>; fn is_part(&self, name: &<Self::Impl as SelectorImpl>::Identifier) -> bool; fn is_empty(&self) -> bool; fn is_root(&self) -> bool; fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool; // Provided methods fn pseudo_element_originating_element(&self) -> Option<Self> { ... } fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool { ... } fn assigned_slot(&self) -> Option<Self> { ... } fn ignores_nth_child_selectors(&self) -> bool { ... }
}

Required Associated Types§

Required Methods§

source

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.

source

fn parent_element(&self) -> Option<Self>

source

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>

The host of the containing shadow root, if any.

source

fn is_pseudo_element(&self) -> bool

Whether we’re matching on a pseudo-element.

source

fn prev_sibling_element(&self) -> Option<Self>

Skips non-element nodes

source

fn next_sibling_element(&self) -> Option<Self>

Skips non-element nodes

source

fn first_element_child(&self) -> Option<Self>

Skips non-element nodes

source

fn is_html_element_in_html_document(&self) -> bool

source

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

Empty string for no namespace

source

fn is_same_type(&self, other: &Self) -> bool

Whether this element and the other element have the same local name and namespace.

source

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

source

fn match_non_ts_pseudo_class( &self, pc: &<Self::Impl as SelectorImpl>::NonTSPseudoClass, context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

source

fn match_pseudo_element( &self, pe: &<Self::Impl as SelectorImpl>::PseudoElement, context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

source

fn apply_selector_flags(&self, flags: ElementSelectorFlags)

Sets selector flags on the elemnt itself or the parent, depending on the flags, which indicate what kind of work may need to be performed when DOM state changes.

Whether this element is a link.

source

fn is_html_slot_element(&self) -> bool

Returns whether the element is an HTML element.

source

fn has_id( &self, id: &<Self::Impl as SelectorImpl>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool

source

fn has_class( &self, name: &<Self::Impl as SelectorImpl>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool

source

fn has_custom_state( &self, name: &<Self::Impl as SelectorImpl>::Identifier, ) -> bool

source

fn imported_part( &self, name: &<Self::Impl as SelectorImpl>::Identifier, ) -> Option<<Self::Impl as SelectorImpl>::Identifier>

Returns the mapping from the exportparts attribute in the reverse direction, that is, in an outer-tree -> inner-tree direction.

source

fn is_part(&self, name: &<Self::Impl as SelectorImpl>::Identifier) -> bool

source

fn is_empty(&self) -> bool

Returns whether this element matches :empty.

That is, whether it does not contain any child element or any non-zero-length text node. See http://dev.w3.org/csswg/selectors-3/#empty-pseudo

source

fn is_root(&self) -> bool

Returns whether this element matches :root, i.e. whether it is the root element of a document.

Note: this can be false even if .parent_element() is None if the parent node is a DocumentFragment.

source

fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool

Add hashes unique to this element to the given filter, returning true if any got added.

Provided Methods§

source

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.

source

fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool

source

fn assigned_slot(&self) -> Option<Self>

Returns the assigned element this element is assigned to.

Necessary for the ::slotted pseudo-class.

source

fn ignores_nth_child_selectors(&self) -> bool

Returns whether this element should ignore matching nth child selector.

Object Safety§

This trait is not object safe.

Implementors§