stdweb::web

Trait INode

Source
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.

(JavaScript docs)

Provided Methods§

Source

fn as_node(&self) -> &Node

Casts a reference to this object into a reference to a Node.

Source

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).

(JavaScript docs)

Source

fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>

Removes a child node from the DOM.

(JavaScript docs)

Source

fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>

Returns a duplicate of the node on which this method was called.

(JavaScript docs)

Source

fn contains<T: INode>(&self, node: &T) -> bool

Checks whenever a given node is a descendant of this one or not.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

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

Returns the parent of this node in the DOM tree.

(JavaScript docs)

Source

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

Returns the node’s first child in the tree, or None if the node is childless.

(JavaScript docs)

Source

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

Returns the node’s last child in the tree, or None if the node is childless.

(JavaScript docs)

Source

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

Returns the node’s next sibling in the tree, or None if there isn’t such a node.

(JavaScript docs)

Source

fn node_name(&self) -> String

Returns the name of the node.

(JavaScript docs)

Source

fn node_type(&self) -> NodeType

Returns the type of the node.

(JavaScript docs)

Source

fn node_value(&self) -> Option<String>

Returns the value of the node.

(JavaScript docs)

Source

fn set_node_value(&self, value: Option<&str>)

Sets the value of the node.

(JavaScript docs)

Source

fn owner_document(&self) -> Option<Document>

Returns the Document that this node belongs to.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

fn previous_sibling(&self) -> Option<Node>

Returns the node’s previous sibling in the tree, or None if there isn’t such a node.

(JavaScript docs)

Source

fn text_content(&self) -> Option<String>

A property which represents the text content of a node and its descendants.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

fn child_nodes(&self) -> NodeList

Returns a live collection of child nodes of this node.

(JavaScript docs)

Source

fn base_uri(&self) -> String

Gets the base URL.

(JavaScript docs)

Source

fn has_child_nodes(&self) -> bool

Returns whether this node has children nodes.

(JavaScript docs)

Source

fn is_default_namespace(&self, namespace: &str) -> bool

Determines whether the given namespace is the default namespace of this node.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

fn is_same_node<T: INode>(&self, node: &T) -> bool

Test whether two Node references are the same.

(JavaScript docs)

Source

fn lookup_prefix(&self, namespace: &str) -> Option<String>

Returns the prefix for the given namespace URI, if present.

(JavaScript docs)

Source

fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>

Returns the namespace URI for the given prefix.

(JavaScript docs)

Source

fn normalize(&self)

Merges any adjacent text nodes and removes empty text nodes under this node.

(JavaScript docs)

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.

Implementors§