Trait stdweb::web::INode
[−]
[src]
pub trait INode: IEventTarget + FromReference { fn as_node(&self) -> &Node { ... } fn append_child<T: INode>(&self, child: &T) { ... } fn remove_child<T: INode>(&self, child: &T) -> Result<(), NotFoundError> { ... } fn clone_node(&self, kind: CloneKind) -> Self { ... } fn contains<T: INode>(&self, node: &T) -> bool { ... } fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U
) { ... } fn replace_child<T: INode, U: INode>(&self, new_child: &T, old_child: &U) { ... } fn parent_node(&self) -> Option<Node> { ... } fn first_child(&self) -> Option<Node> { ... } fn inner_text(&self) -> String { ... } fn text_content(&self) -> Option<String> { ... } fn set_text_content(&self, text: &str) { ... } fn child_nodes(&self) -> NodeList { ... } }
INode
is an interface from which a number of DOM API object types inherit.
Provided Methods
fn as_node(&self) -> &Node
Casts a reference to this object into a reference to a Node.
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).
fn remove_child<T: INode>(&self, child: &T) -> Result<(), NotFoundError>
Removes a child node from the DOM.
fn clone_node(&self, kind: CloneKind) -> Self
Returns a duplicate of the node on which this method was called.
fn contains<T: INode>(&self, node: &T) -> bool
Checks whenever a given node is a descendant of this one or not.
fn insert_before<T: INode, U: INode>(&self, new_node: &T, reference_node: &U)
Inserts the specified node before the reference node as a child of the current node.
fn replace_child<T: INode, U: INode>(&self, new_child: &T, old_child: &U)
Replaces one hild node of the specified node with another.
fn parent_node(&self) -> Option<Node>
Returns the parent of this node in the DOM tree.
fn first_child(&self) -> Option<Node>
Returns the node's first child in the tree, or None
if the node is childless.
fn inner_text(&self) -> String
A property which represents the "rendered" text content of a node and its descendants. It approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied to the clipboard.
This feature was originally introduced by Internet Explorer, and was formally specified in the HTML standard in 2016 after being adopted by all major browser vendors.
fn text_content(&self) -> Option<String>
A property which represents the text content of a node and its descendants.
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.
fn child_nodes(&self) -> NodeList
Returns a live collection of child nodes of this node.
Implementors
impl INode for Document
impl INode for Node
impl INode for Element
impl INode for HtmlElement
impl INode for ImageElement
impl INode for InputElement