Trait style::dom::TNode

source ·
pub trait TNode: Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
    type ConcreteElement: TElement<ConcreteNode = Self>;
    type ConcreteDocument: TDocument<ConcreteNode = Self>;
    type ConcreteShadowRoot: TShadowRoot<ConcreteNode = Self>;

Show 19 methods // Required methods fn parent_node(&self) -> Option<Self>; fn first_child(&self) -> Option<Self>; fn last_child(&self) -> Option<Self>; fn prev_sibling(&self) -> Option<Self>; fn next_sibling(&self) -> Option<Self>; fn owner_doc(&self) -> Self::ConcreteDocument; fn is_in_document(&self) -> bool; fn traversal_parent(&self) -> Option<Self::ConcreteElement>; fn opaque(&self) -> OpaqueNode; fn debug_id(self) -> usize; fn as_element(&self) -> Option<Self::ConcreteElement>; fn as_document(&self) -> Option<Self::ConcreteDocument>; fn as_shadow_root(&self) -> Option<Self::ConcreteShadowRoot>; // Provided methods fn dom_children(&self) -> DomChildren<Self> { ... } fn dom_descendants(&self) -> DomDescendants<Self> { ... } fn next_in_preorder(&self, scoped_to: Self) -> Option<Self> { ... } fn depth(&self) -> usize { ... } fn parent_element(&self) -> Option<Self::ConcreteElement> { ... } fn parent_element_or_host(&self) -> Option<Self::ConcreteElement> { ... }
}
Expand description

The TNode trait. This is the main generic trait over which the style system can be implemented.

Required Associated Types§

source

type ConcreteElement: TElement<ConcreteNode = Self>

The concrete TElement type.

source

type ConcreteDocument: TDocument<ConcreteNode = Self>

The concrete TDocument type.

source

type ConcreteShadowRoot: TShadowRoot<ConcreteNode = Self>

The concrete TShadowRoot type.

Required Methods§

source

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

Get this node’s parent node.

source

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

Get this node’s first child.

source

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

Get this node’s last child.

source

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

Get this node’s previous sibling.

source

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

Get this node’s next sibling.

source

fn owner_doc(&self) -> Self::ConcreteDocument

Get the owner document of this node.

source

fn is_in_document(&self) -> bool

Returns whether the node is attached to a document.

source

fn traversal_parent(&self) -> Option<Self::ConcreteElement>

Get this node’s parent element from the perspective of a restyle traversal.

source

fn opaque(&self) -> OpaqueNode

Converts self into an OpaqueNode.

source

fn debug_id(self) -> usize

A debug id, only useful, mm… for debugging.

source

fn as_element(&self) -> Option<Self::ConcreteElement>

Get this node as an element, if it’s one.

source

fn as_document(&self) -> Option<Self::ConcreteDocument>

Get this node as a document, if it’s one.

source

fn as_shadow_root(&self) -> Option<Self::ConcreteShadowRoot>

Get this node as a ShadowRoot, if it’s one.

Provided Methods§

source

fn dom_children(&self) -> DomChildren<Self>

Iterate over the DOM children of a node.

source

fn dom_descendants(&self) -> DomDescendants<Self>

Iterate over the DOM children of a node, in preorder.

source

fn next_in_preorder(&self, scoped_to: Self) -> Option<Self>

Returns the next node after this one, in a pre-order tree-traversal of the subtree rooted at scoped_to.

source

fn depth(&self) -> usize

Returns the depth of this node in the DOM.

source

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

Get this node’s parent element if present.

source

fn parent_element_or_host(&self) -> Option<Self::ConcreteElement>

Get this node’s parent element, or shadow host if it’s a shadow root.

Object Safety§

This trait is not object safe.

Implementors§