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.
docs.rs failed to build dom-cat-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

dom-cat

Persistent DOM: arena-backed Node tree with a mutation API and CSS-selector matching.

dom-cat is the third sub-crate of a comp-cat-rs Servo-replacement webview runtime targeting Tauri integration. It consumes html-cat trees and matches against css-cat selectors. Same framework constraints as the rest of the stack: no mut, no Rc/Arc, no interior mutability, no panics, exhaustive matches, static dispatch.

Example

use dom_cat::{Document, Error};

fn main() -> Result<(), Error> {
    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 = doc.query_selector(".hi")?;
    assert!(matched.is_some());
    Ok(())
}

v0 scope

  • Arena-backed Document (BTreeMap<NodeId, Node>).
  • Persistent mutation: every operation returns a new Document.
  • Node kinds: Document, Element, Text, Comment.
  • Mutation API: append_child, remove_child, set_attribute, remove_attribute, replace_text, replace_with.
  • Selector matching with all four combinators and a useful set of simple selectors / pseudo-classes.
  • query_selector / query_selector_all.

Deferred to v0.2+

  • Full pseudo-class set (:nth-child, :is, :not, :where, :has).
  • Pseudo-elements.
  • Live HTMLCollection semantics (we return snapshots).
  • Range / Selection APIs.
  • Shadow DOM, mutation observers.

License

MIT OR Apache-2.0