Trait selectors::Element
[−]
[src]
pub trait Element: MatchAttr + Sized { fn parent_element(&self) -> Option<Self>; fn first_child_element(&self) -> Option<Self>; fn last_child_element(&self) -> Option<Self>; fn prev_sibling_element(&self) -> Option<Self>; fn next_sibling_element(&self) -> Option<Self>; fn is_html_element_in_html_document(&self) -> bool; fn get_local_name(&self) -> &Self::Impl::BorrowedLocalName; fn get_namespace(&self) -> &Self::Impl::BorrowedNamespace; fn match_non_ts_pseudo_class(&self, pc: Self::Impl::NonTSPseudoClass) -> bool; fn get_id(&self) -> Option<Self::Impl::Identifier>; fn has_class(&self, name: &Self::Impl::ClassName) -> bool; fn is_empty(&self) -> bool; fn is_root(&self) -> bool; fn each_class<F>(&self, callback: F) where F: FnMut(&Self::Impl::ClassName); fn insert_flags(&self, _flags: ElementFlags) { ... } }
Required Methods
fn parent_element(&self) -> Option<Self>
fn first_child_element(&self) -> Option<Self>
fn last_child_element(&self) -> Option<Self>
fn prev_sibling_element(&self) -> Option<Self>
fn next_sibling_element(&self) -> Option<Self>
fn is_html_element_in_html_document(&self) -> bool
fn get_local_name(&self) -> &Self::Impl::BorrowedLocalName
fn get_namespace(&self) -> &Self::Impl::BorrowedNamespace
fn match_non_ts_pseudo_class(&self, pc: Self::Impl::NonTSPseudoClass) -> bool
fn get_id(&self) -> Option<Self::Impl::Identifier>
fn has_class(&self, name: &Self::Impl::ClassName) -> bool
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
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
.
fn each_class<F>(&self, callback: F) where F: FnMut(&Self::Impl::ClassName)
Provided Methods
fn insert_flags(&self, _flags: ElementFlags)
Add flags to the element. See the ElementFlags
docs for details.
This may be called while the element or one of its children is being matched. Therefore the implementation must be thread-safe if children may be matched in parallel.