pub trait INode: IEventTarget {
Show 29 methods
// Provided methods
fn as_node(&self) -> &Node { ... }
fn append_child<T: INode>(&self, child: &T) { ... }
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError> { ... }
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO> { ... }
fn contains<T: INode>(&self, node: &T) -> bool { ... }
fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U,
) -> Result<Node, InsertNodeError> { ... }
fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U,
) -> Result<Node, InsertNodeError> { ... }
fn parent_node(&self) -> Option<Node> { ... }
fn first_child(&self) -> Option<Node> { ... }
fn last_child(&self) -> Option<Node> { ... }
fn next_sibling(&self) -> Option<Node> { ... }
fn node_name(&self) -> String { ... }
fn node_type(&self) -> NodeType { ... }
fn node_value(&self) -> Option<String> { ... }
fn set_node_value(&self, value: Option<&str>) { ... }
fn owner_document(&self) -> Option<Document> { ... }
fn parent_element(&self) -> Option<Element> { ... }
fn previous_sibling(&self) -> Option<Node> { ... }
fn text_content(&self) -> Option<String> { ... }
fn set_text_content(&self, text: &str) { ... }
fn child_nodes(&self) -> NodeList { ... }
fn base_uri(&self) -> String { ... }
fn has_child_nodes(&self) -> bool { ... }
fn is_default_namespace(&self, namespace: &str) -> bool { ... }
fn is_equal_node<T: INode>(&self, node: &T) -> bool { ... }
fn is_same_node<T: INode>(&self, node: &T) -> bool { ... }
fn lookup_prefix(&self, namespace: &str) -> Option<String> { ... }
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String> { ... }
fn normalize(&self) { ... }
}
Expand description
INode
is an interface from which a number of DOM API object types inherit.
Provided Methods§
Sourcefn append_child<T: INode>(&self, child: &T)
fn append_child<T: INode>(&self, child: &T)
Adds a node to the end of the list of children of a specified parent node.
If the given child is a reference to an existing node in the document then it is moved from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node).
Sourcefn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>
Removes a child node from the DOM.
Sourcefn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
Returns a duplicate of the node on which this method was called.
Sourcefn contains<T: INode>(&self, node: &T) -> bool
fn contains<T: INode>(&self, node: &T) -> bool
Checks whenever a given node is a descendant of this one or not.
Sourcefn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U,
) -> Result<Node, InsertNodeError>
fn insert_before<T: INode, U: INode>( &self, new_node: &T, reference_node: &U, ) -> Result<Node, InsertNodeError>
Inserts the specified node before the reference node as a child of the current node.
Sourcefn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U,
) -> Result<Node, InsertNodeError>
fn replace_child<T: INode, U: INode>( &self, new_child: &T, old_child: &U, ) -> Result<Node, InsertNodeError>
Replaces one hild node of the specified node with another.
Sourcefn parent_node(&self) -> Option<Node>
fn parent_node(&self) -> Option<Node>
Returns the parent of this node in the DOM tree.
Sourcefn first_child(&self) -> Option<Node>
fn first_child(&self) -> Option<Node>
Returns the node’s first child in the tree, or None
if the node is childless.
Sourcefn last_child(&self) -> Option<Node>
fn last_child(&self) -> Option<Node>
Returns the node’s last child in the tree, or None
if the node is childless.
Sourcefn next_sibling(&self) -> Option<Node>
fn next_sibling(&self) -> Option<Node>
Returns the node’s next sibling in the tree, or None
if there isn’t such a node.
Sourcefn node_value(&self) -> Option<String>
fn node_value(&self) -> Option<String>
Returns the value of the node.
Sourcefn set_node_value(&self, value: Option<&str>)
fn set_node_value(&self, value: Option<&str>)
Sets the value of the node.
Sourcefn owner_document(&self) -> Option<Document>
fn owner_document(&self) -> Option<Document>
Returns the Document
that this node belongs to.
Sourcefn parent_element(&self) -> Option<Element>
fn parent_element(&self) -> Option<Element>
Returns an Element
that is the parent of this node. Returns null
if the node
has no parent or the parent is not an Element
.
Sourcefn previous_sibling(&self) -> Option<Node>
fn previous_sibling(&self) -> Option<Node>
Returns the node’s previous sibling in the tree, or None
if there isn’t such a node.
Sourcefn text_content(&self) -> Option<String>
fn text_content(&self) -> Option<String>
A property which represents the text content of a node and its descendants.
Sourcefn set_text_content(&self, text: &str)
fn set_text_content(&self, text: &str)
Sets the text content of this node; calling thil removes all of node’s children and replaces them with a single text node with the given value.
Sourcefn child_nodes(&self) -> NodeList
fn child_nodes(&self) -> NodeList
Returns a live collection of child nodes of this node.
Sourcefn has_child_nodes(&self) -> bool
fn has_child_nodes(&self) -> bool
Returns whether this node has children nodes.
Sourcefn is_default_namespace(&self, namespace: &str) -> bool
fn is_default_namespace(&self, namespace: &str) -> bool
Determines whether the given namespace is the default namespace of this node.
Sourcefn is_equal_node<T: INode>(&self, node: &T) -> bool
fn is_equal_node<T: INode>(&self, node: &T) -> bool
Tests whether this node is equal to another node. Two nodes are equal if they have the same type, defining characteristics, matching attributes, and so on.
Sourcefn is_same_node<T: INode>(&self, node: &T) -> bool
fn is_same_node<T: INode>(&self, node: &T) -> bool
Test whether two Node
references are the same.
Sourcefn lookup_prefix(&self, namespace: &str) -> Option<String>
fn lookup_prefix(&self, namespace: &str) -> Option<String>
Returns the prefix for the given namespace URI, if present.
Sourcefn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
Returns the namespace URI for the given prefix.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.