Skip to main content

rdom_core/
lib.rs

1//! # rdom-core — arena-backed DOM for Rust
2//!
3//! A pure DOM tree with no rendering dependencies. Node / Element / Text /
4//! Comment / Fragment types, full tree mutation, attributes, classes, and
5//! (in later phases) query selectors, events, and O(1) index lookups.
6//!
7//! Designed to be paired with `rdom-tui` for terminal rendering, or used
8//! standalone for headless tree manipulation, tests, templates, and
9//! hypothetical alternative renderers.
10//!
11//! ## Quick tour
12//!
13//! ```
14//! use rdom_core::{Dom, AdjacentPosition};
15//!
16//! let mut dom: Dom = Dom::new();
17//! let root = dom.root();
18//!
19//! let hero = dom.create_element("div");
20//! dom.node_mut(hero).set_id("hero").unwrap();
21//! dom.node_mut(hero).add_class("active").unwrap();
22//!
23//! let title = dom.create_element("h1");
24//! let text = dom.create_text_node("Welcome");
25//! dom.node_mut(title).append_child(text).unwrap();
26//! dom.node_mut(hero).append_child(title).unwrap();
27//! dom.node_mut(root).append_child(hero).unwrap();
28//!
29//! assert_eq!(dom.node(root).child_element_count(), 1);
30//! assert_eq!(dom.node(hero).first_element_child().unwrap().tag_name(), Some("h1"));
31//! ```
32
33mod abort;
34mod accessor;
35mod attrs;
36mod clone;
37mod constraint;
38mod content_editable;
39mod dispatch;
40mod dom;
41mod dom_string_map;
42mod error;
43mod event;
44mod event_detail;
45mod form_assoc;
46mod form_control;
47mod html_collection;
48mod indexes;
49mod input_type;
50mod insert_adjacent;
51mod markup;
52mod node;
53mod node_id;
54mod node_list;
55mod node_or_string;
56mod observer;
57mod position;
58mod query;
59mod query_selector;
60mod radio_group;
61mod selection;
62pub mod selectors;
63mod text;
64mod token_list;
65mod tree;
66mod validate;
67
68pub use abort::{AbortController, AbortSignal};
69pub use accessor::{ChildIter, ElementChildIter, NodeMut, NodeRef};
70pub use constraint::ValidityHook;
71pub use content_editable::ContentEditableState;
72pub use dispatch::{ActivationHook, ActivationPhase, EventCtx, ListenerId, ListenerOptions};
73pub use dom::Dom;
74pub use dom_string_map::{DomStringMap, DomStringMapMut};
75pub use error::{DomError, Result};
76pub use event::{Event, EventPhase};
77pub use event_detail::{
78    EventDetail, FormEnctype, FormMethod, InputDetail, InputType, KeyboardDetail,
79    KeyboardModifiers, MouseButton, MouseDetail, SubmitDetail, ToggleDetail, ToggleState,
80    TransitionDetail,
81};
82pub use html_collection::{FormControlsCollection, HtmlCollection};
83pub use input_type::InputTypeState;
84pub use markup::{VOID_ELEMENTS, is_void_element};
85pub use node::{NodeData, NodeType};
86pub use node_id::NodeId;
87pub use node_list::NodeList;
88pub use node_or_string::NodeOrString;
89pub use observer::{InteractionKind, Mutation, MutationObserver, ObserverId};
90pub use position::DocumentPosition;
91pub use selection::{Position, Range, Selection, SelectionSerial};
92pub use token_list::{DomTokenList, DomTokenListMut};
93pub use tree::AdjacentPosition;
94pub use validate::InvariantViolation;