pub struct ElementRef<'a> { /* private fields */ }
Expand description

Wrapper around a reference to an element node.

This wrapper implements the Element trait from the selectors crate, which allows it to be matched against CSS selectors.

Implementations

Wraps a NodeRef only if it references a Node::Element.

Returns the Element referenced by self.

Returns an iterator over descendent elements matching a selector.

Returns the HTML of this element.

Returns the inner HTML of this element.

Returns an iterator over descendent text nodes.

Methods from Deref<Target = NodeRef<'a, Node>>

Returns the ID of this node.

Returns the tree owning this node.

Returns the value of this node.

Returns the parent of this node.

Returns the previous sibling of this node.

Returns the next sibling of this node.

Returns the first child of this node.

Returns the last child of this node.

Returns true if this node has siblings.

Returns true if this node has children.

Returns an iterator over ancestors.

Returns an iterator over previous siblings.

Returns an iterator over next siblings.

Returns an iterator over first children.

Returns an iterator over last children.

Returns an iterator over children.

Returns an iterator which traverses the subtree starting at this node.

Returns an iterator over this node and its descendants.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Note: will never match against non-tree-structure pseudo-classes.

Converts self into an opaque representation.

Whether the parent node of this element is a shadow root.

The host of the containing shadow root, if any.

Whether we’re matching on a pseudo-element.

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

Returns the mapping from the exportparts attribute in the regular direction, that is, inner-tree -> outer-tree. Read more

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

Skips non-element nodes

Skips non-element nodes

Empty string for no namespace

Whether this element is a link.

Returns whether the element is an HTML element.

Returns whether this element matches :empty. Read more

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

The parent of a given pseudo-element, after matching a pseudo-element selector. Read more

Returns the assigned element this element is assigned to. Read more

Returns whether this element should ignore matching nth child selector. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Take the serializer and call its methods to serialize this type. The type will dictate which methods are called and with what parameters. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.