pub struct DomElement<'a> {
pub dom: &'a Dom,
pub id: NodeId,
}Expand description
Cheap (Copy) handle that pairs a NodeId with the Dom
arena. Implements crate::html_css::css::matcher::Element so the
CSS cascade matches selectors against real document nodes.
Fields§
§dom: &'a DomBacking arena.
id: NodeIdNode id (must point to an Element).
Implementations§
Source§impl<'a> DomElement<'a>
impl<'a> DomElement<'a>
Source§impl<'a> DomElement<'a>
impl<'a> DomElement<'a>
Sourcepub fn children_iter(&self) -> ElementChildren<DomElement<'a>> ⓘ
pub fn children_iter(&self) -> ElementChildren<DomElement<'a>> ⓘ
Iterator alias matching Element::element_children.
Trait Implementations§
Source§impl<'a> Clone for DomElement<'a>
impl<'a> Clone for DomElement<'a>
Source§fn clone(&self) -> DomElement<'a>
fn clone(&self) -> DomElement<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for DomElement<'a>
Source§impl<'a> Debug for DomElement<'a>
impl<'a> Debug for DomElement<'a>
Source§impl<'a> Element for DomElement<'a>
impl<'a> Element for DomElement<'a>
Source§fn local_name(&self) -> &str
fn local_name(&self) -> &str
Lowercase HTML tag name (
"div", "p", …).Source§fn has_class(&self, c: &str) -> bool
fn has_class(&self, c: &str) -> bool
True if the
class attribute contains class_name as a
whitespace-separated token.Source§fn attribute(&self, name: &str) -> Option<&str>
fn attribute(&self, name: &str) -> Option<&str>
Get an attribute value by name (case-insensitive in HTML; the
matcher passes the selector’s exact casing — implementor
normalises).
Source§fn has_attribute(&self, name: &str) -> bool
fn has_attribute(&self, name: &str) -> bool
True if the named attribute is present (regardless of value).
Source§fn prev_element_sibling(&self) -> Option<Self>
fn prev_element_sibling(&self) -> Option<Self>
Previous element sibling (skip text/comment nodes).
Source§fn next_element_sibling(&self) -> Option<Self>
fn next_element_sibling(&self) -> Option<Self>
Next element sibling.
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
True iff the element has no element children and no
non-whitespace text content. CSS
:empty.Source§fn first_element_child(&self) -> Option<Self>
fn first_element_child(&self) -> Option<Self>
First element child, if any.
Source§fn sibling_index(&self) -> usize
fn sibling_index(&self) -> usize
1-indexed sibling position among element siblings.
Used by
:nth-child and :first-child/:last-child.Source§fn sibling_count(&self) -> usize
fn sibling_count(&self) -> usize
Total number of element siblings including this one.
Used by
:nth-last-child and :last-child.Source§fn sibling_index_of_type(&self) -> usize
fn sibling_index_of_type(&self) -> usize
1-indexed position among siblings sharing the same
local_name.Source§fn sibling_count_of_type(&self) -> usize
fn sibling_count_of_type(&self) -> usize
Total number of siblings sharing the same
local_name (incl. self).Source§fn any_descendant<F: FnMut(Self) -> bool>(&self, pred: F) -> bool
fn any_descendant<F: FnMut(Self) -> bool>(&self, pred: F) -> bool
True iff some descendant matches
pred. Default: depth-first
walk via an explicit stack so generics don’t blow up
instantiation depth on :has() calls. Implementors with an
arena can override for speed.Source§fn element_children(&self) -> ElementChildren<Self> ⓘ
fn element_children(&self) -> ElementChildren<Self> ⓘ
Iterator over direct element children. Default walks via
next_element_sibling() from first_element_child().Auto Trait Implementations§
impl<'a> Freeze for DomElement<'a>
impl<'a> RefUnwindSafe for DomElement<'a>
impl<'a> Send for DomElement<'a>
impl<'a> Sync for DomElement<'a>
impl<'a> Unpin for DomElement<'a>
impl<'a> UnsafeUnpin for DomElement<'a>
impl<'a> UnwindSafe for DomElement<'a>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.