Type Alias Node

Source
pub type Node = Rc<Node>;
Expand description

A HTML5 node.

Aliased Type§

pub struct Node { /* private fields */ }

Trait Implementations§

Source§

impl NodeExt for Node

Source§

fn children(&self) -> &RefCell<Vec<Node>>

The children of this node.
Source§

fn data(&self) -> &NodeData

Source§

fn append_children(&self, children: Vec<Node>)

Appends the given children to the node.
Source§

fn append_child(&self, child: Node)

Appends the given child to the node.
Source§

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

Returns the tag name as string if available.
Source§

fn attr(self, name: &str, value: &str) -> Self

Adds an Attribute with given name and value to the node. Read more
Source§

fn borrow_attr(&self, name: &str, value: &str)

Adds an Attribute with given name and value to the node without consuming self. Read more
Source§

fn attrs(self, attributes: Vec<(&str, &str)>) -> Self

Adds a list of attributes to the node. Read more
Source§

fn borrow_attrs(&self, attributes: Vec<(&str, &str)>)

Adds a list of attributes to the node without consuming self. Read more
Source§

fn find_attribute(&self, attribute_name: &str) -> Option<usize>

Returns the attribute index if present.
Source§

fn attribute_eq(&self, attribute_name: &str, value: &str) -> bool

Checks if the given attribute matches the value.
Source§

fn add_class(&self, class_value: &str)

Adds value to the class attribute. Adds the class attribute if it is not present.
Source§

fn remove_class(&self, class_value: &str)

Removes the given value from the class attribute.
Source§

fn has_class(&self, class_value: &str) -> bool

True if value is available in class attribute.
Source§

fn toggle_class(&self, class_value: &str)

Toggles the given value of the class attribute. Creates the class attribute if not set yet.
Source§

fn remove_attribute(&self, name: &str)

Removes the attribute with the given name. Does nothing if the attribute does not exist. This method does not compare its values.