lewp_html/node.rs
1//! Implementation of a generic HTML5 node.
2
3use std::{cell::RefCell, rc::Rc};
4
5/// A HTML5 node.
6pub type Node = Rc<rcdom::Node>;
7
8impl crate::NodeExt for Node {
9 fn children(&self) -> &RefCell<Vec<Node>> {
10 &self.children
11 }
12 fn data(&self) -> &rcdom::NodeData {
13 &self.data
14 }
15 fn append_children(&self, children: Vec<Node>) {
16 for child in children {
17 self.append_child(child);
18 }
19 }
20 fn append_child(&self, child: Node) {
21 self.children.borrow_mut().push(child);
22 }
23}