Expand description
Host-neutral read side of the dynamic DOM API: query / get_by_id /
traversal over the per-tick lumen_core::node::DomIndex snapshot.
Host-neutral read side of the dynamic DOM API: selector queries,
get_by_id, and traversal over the per-tick [DomIndex] snapshot.
Script hosts and the C-ABI all funnel
through these functions. Handles cross the boundary as a packed u64
([NodeHandle::pack]); candela, whose value type is i32, interns the
handle into the process-global side-table instead (see
lumen_core::node::intern_node).
Selector matching reuses the cascade matcher in lumen-ir; there is
no second selector engine. A query walks each snapshot record’s
ancestor chain (root-first) and applies
lumen_ir::css::selector_matches. Sibling combinators (+, ~)
inherit the matcher’s conservative-fail behavior.
Structs§
- DomDetails
- Snapshot of per-node details plus the cascade inputs
computed_styleneeds. Rebuilt and published by the runtime each tick. - Node
Detail - Per-node detail carried in the snapshot, keyed by packed handle.
- Node
Query Result - Materialized query result: packed handles in document order. Mirrors
the Bevy-flavored
NodeQueryconsumers the host types wrap. - NodeRef
- Host-neutral packed node handle.
0is reserved for “no node”.
Functions§
- attributes_
of_ handle - The generic attribute map (attrs with no typed component) published for
handle, ordered. Backs the introspectionattrs()getter. - build_
clone source.clone_deep(): mint a reserved token for the clone root and the backingScriptCommand.- build_
spawn create(tag): mint a reserved token and the backingScriptCommand. Returns(handle, command); the handle is valid for the whole tick.- build_
spawn_ fragment - Instantiate the fragment
key: mint a reserved token for the instance root and the backingScriptCommand.argsbinds parameters,childrenfills slots with nodes that already exist. - closest_
entity - Walk from
startup the ancestor chain (includingstart) and return the nearest element matchingselector(node.closest(sel)). - dom_
details_ snapshot - Read the current detail snapshot (cheap
Arcclone). - drain_
external_ dom_ commands - Drain all queued external DOM commands (FIFO). Called by the runtime once per tick.
- focused_
node document.focused(): the focused node handle, orNone.- hovered_
node document.hovered(): the hovered node handle, orNone.- node_
children node.children(): packed handles in document order.- node_
class_ contains node.class_list().contains(class).- node_
closest node.closest(sel): nearest matching ancestor-or-self, packed handle.- node_
computed_ style node.computed_style(prop): the value ofpropafter the full cascade (stylesheet + inherited + inline). Reflects the last committed tick; an inline write issued this tick is visible next tick (commands apply at drain). ReturnsNonefor an unmodeled property or an unknown node.- node_
first_ child node.first_child().- node_
get_ attr node.get_attr(name). KNOWN attrs resolve from the index (id,class,text); everything else from the generic attribute map.- node_id
node.id(): the node’s stable id, orNone.- node_
last_ child node.last_child().- node_
next node.next().- node_
parent node.parent().- node_
prev node.prev().- node_
style_ get node.style_get(prop): the inline-style override forprop, orNone.- node_
text node.text(): the node’s current text content, orNone.- node_
valid node.exists()/node_valid(h): whether the handle is present in the current snapshot. The snapshot rebuilds each tick, so a despawned node drops out; this is the read-side liveness check without a live world.- publish_
dom_ details - Publish a freshly-built detail snapshot for cross-thread readers. The
runtime calls this each tick from the same system that publishes the
DomIndex. - publish_
focus - Publish the current focus / hover targets (packed handles). The runtime calls this each tick.
- push_
external_ dom_ command - Enqueue a mutation command from a non-script surface (C-ABI / SDK).
Returns
falseonly if the process-global lock is poisoned. - query_
entities - Run a selector query against
index, returning matched entities in document order. Errors carry the selector parse message. - resolved_
attributes - The fully-cascaded
Attributesforhandle: the element resolved from scratch the way a restyle resolves it, from its tag, classes and id, its place in the live tree, and its own markup and inline-style declarations, which outrank every rule. Shared bycomputed_style(prop)and the full-mapcomputed_style()introspection getter. Reflects the last committed tick. - run_
document document(): the root element as a packed handle.- run_
get_ by_ id get_by_id(id): fast id path, packed handle orNone.- run_
query query(sel): run against the current snapshot, packed handles.