# 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`](https://crates.io/crates/html-cat) trees and matches against [`css-cat`](https://crates.io/crates/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
```rust
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