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§
sourcetype ConcreteElement: TElement<ConcreteNode = Self>
type ConcreteElement: TElement<ConcreteNode = Self>
The concrete TElement
type.
sourcetype ConcreteDocument: TDocument<ConcreteNode = Self>
type ConcreteDocument: TDocument<ConcreteNode = Self>
The concrete TDocument
type.
sourcetype ConcreteShadowRoot: TShadowRoot<ConcreteNode = Self>
type ConcreteShadowRoot: TShadowRoot<ConcreteNode = Self>
The concrete TShadowRoot
type.
Required Methods§
sourcefn parent_node(&self) -> Option<Self>
fn parent_node(&self) -> Option<Self>
Get this node’s parent node.
sourcefn first_child(&self) -> Option<Self>
fn first_child(&self) -> Option<Self>
Get this node’s first child.
sourcefn last_child(&self) -> Option<Self>
fn last_child(&self) -> Option<Self>
Get this node’s last child.
sourcefn prev_sibling(&self) -> Option<Self>
fn prev_sibling(&self) -> Option<Self>
Get this node’s previous sibling.
sourcefn next_sibling(&self) -> Option<Self>
fn next_sibling(&self) -> Option<Self>
Get this node’s next sibling.
sourcefn owner_doc(&self) -> Self::ConcreteDocument
fn owner_doc(&self) -> Self::ConcreteDocument
Get the owner document of this node.
sourcefn is_in_document(&self) -> bool
fn is_in_document(&self) -> bool
Returns whether the node is attached to a document.
sourcefn traversal_parent(&self) -> Option<Self::ConcreteElement>
fn traversal_parent(&self) -> Option<Self::ConcreteElement>
Get this node’s parent element from the perspective of a restyle traversal.
sourcefn opaque(&self) -> OpaqueNode
fn opaque(&self) -> OpaqueNode
Converts self into an OpaqueNode
.
sourcefn as_element(&self) -> Option<Self::ConcreteElement>
fn as_element(&self) -> Option<Self::ConcreteElement>
Get this node as an element, if it’s one.
sourcefn as_document(&self) -> Option<Self::ConcreteDocument>
fn as_document(&self) -> Option<Self::ConcreteDocument>
Get this node as a document, if it’s one.
sourcefn as_shadow_root(&self) -> Option<Self::ConcreteShadowRoot>
fn as_shadow_root(&self) -> Option<Self::ConcreteShadowRoot>
Get this node as a ShadowRoot, if it’s one.
Provided Methods§
sourcefn dom_children(&self) -> DomChildren<Self> ⓘ
fn dom_children(&self) -> DomChildren<Self> ⓘ
Iterate over the DOM children of a node.
sourcefn dom_descendants(&self) -> DomDescendants<Self> ⓘ
fn dom_descendants(&self) -> DomDescendants<Self> ⓘ
Iterate over the DOM children of a node, in preorder.
sourcefn next_in_preorder(&self, scoped_to: Self) -> Option<Self>
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.
sourcefn parent_element(&self) -> Option<Self::ConcreteElement>
fn parent_element(&self) -> Option<Self::ConcreteElement>
Get this node’s parent element if present.
sourcefn parent_element_or_host(&self) -> Option<Self::ConcreteElement>
fn parent_element_or_host(&self) -> Option<Self::ConcreteElement>
Get this node’s parent element, or shadow host if it’s a shadow root.