dom-cat 0.1.0

Persistent DOM model: arena-backed Node tree with mutation API and CSS-selector matching. Consumes html-cat trees; selectors via css-cat. No mut, no Rc/Arc, no interior mutability, no panics, exhaustive matches. Third sub-crate of a Servo-replacement webview runtime targeting Tauri.
//! Persistent DOM model with mutation API and CSS-selector matching.
//!
//! # Example
//!
//! ```
//! # fn main() -> Result<(), dom_cat::Error> {
//! use dom_cat::Document;
//!
//! let html_doc = html_cat::parse("<html><body><p class=\"hi\">Hello</p></body></html>")?;
//! let doc = Document::from_html_doc(&html_doc);
//! let matched = dom_cat::query_selector(&doc, ".hi")?;
//! assert!(matched.is_some());
//! # Ok(())
//! # }
//! ```

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(clippy::similar_names)]

pub mod build;
pub mod document;
pub mod error;
pub mod matcher;
pub mod mutation;
pub mod node;
pub mod query;
pub mod selector_parse;

pub use document::Document;
pub use error::Error;
pub use mutation::{append_child, remove_attribute, remove_child, replace_text, set_attribute};
pub use node::{Arena, CommentData, DocumentData, ElementData, Node, NodeId, TextData};
pub use query::{query_selector, query_selector_all};

impl Document {
    /// Build a DOM from an `html-cat` document tree.
    #[must_use]
    pub fn from_html_doc(source: &html_cat::Document) -> Self {
        build::from_html_doc(source)
    }
}