use html5ever::tree_builder::QuirksMode; use html5ever::QualName; use std::cell::{Cell, RefCell}; use std::fmt; use std::ops::Deref; use std::rc::{Rc, Weak}; use crate::attributes::{Attribute, Attributes, ExpandedName}; use crate::cell_extras::*; use crate::iter::NodeIterator; /// Node data specific to the node type. #[derive(Debug, PartialEq, Clone)] pub enum NodeData { /// Element node Element(ElementData), /// Text node Text(RefCell), /// Comment node Comment(RefCell), /// Processing instruction node ProcessingInstruction(RefCell<(String, String)>), /// Doctype node Doctype(Doctype), /// Document node Document(DocumentData), /// Document fragment node DocumentFragment, } /// Data specific to doctype nodes. #[derive(Debug, PartialEq, Clone)] pub struct Doctype { /// The name of the doctype pub name: String, /// The public ID of the doctype pub public_id: String, /// The system ID of the doctype pub system_id: String, } /// Data specific to element nodes. #[derive(Debug, PartialEq, Clone)] pub struct ElementData { /// The namespace and local name of the element, such as `ns!(html)` and `body`. pub name: QualName, /// The attributes of the elements. pub attributes: RefCell, /// If the element is an HTML `