Trait stdweb::web::INode
[−]
[src]
pub trait INode: IEventTarget { 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) { ... } }
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<Node, NotFoundError>
Removes a child node from the DOM.
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
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
) -> Result<Node, InsertNodeError>
&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.
fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>
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 last_child(&self) -> Option<Node>
Returns the node's last child in the tree, or None
if the node is childless.
fn next_sibling(&self) -> Option<Node>
Returns the node's next sibling in the tree, or None
if there isn't such a node.
fn node_name(&self) -> String
Returns the name of the node.
fn node_type(&self) -> NodeType
Returns the type of the node.
fn node_value(&self) -> Option<String>
Returns the value of the node.
fn set_node_value(&self, value: Option<&str>)
Sets the value of the node.
fn owner_document(&self) -> Option<Document>
Returns the Document
that this node belongs to.
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
.
fn previous_sibling(&self) -> Option<Node>
Returns the node's previous sibling in the tree, or None
if there isn't such a node.
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.
fn base_uri(&self) -> String
Gets the base URL.
fn has_child_nodes(&self) -> bool
Returns whether this node has children nodes.
fn is_default_namespace(&self, namespace: &str) -> bool
Determines whether the given namespace is the default namespace of this node.
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.
fn is_same_node<T: INode>(&self, node: &T) -> bool
Test whether two Node
references are the same.
fn lookup_prefix(&self, namespace: &str) -> Option<String>
Returns the prefix for the given namespace URI, if present.
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
Returns the namespace URI for the given prefix.
fn normalize(&self)
Merges any adjacent text nodes and removes empty text nodes under 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
impl INode for TextAreaElement
impl INode for CanvasElement
impl INode for TextNode