Expand description
The dynamic DOM: the tree a script reads, and the mutations it issues.
A script reaches the scene through two channels, and both are here because
neither knows anything about the platform underneath. The read side is
build_dom_index, which republishes the live tree each tick so a
query() from a handler sees this tick’s nodes. The write side is a pair:
collect_dom_commands gathers this tick’s mutations in issue order, and
apply_dom_commands materializes them against the world.
Script-issued mutations arrive as
ScriptCommandEvents; C-ABI
and SDK mutations arrive on the process-global external DOM bus
(lumen_script::node_query::drain_external_dom_commands). Both funnel
into one FIFO pass so a fluent chain’s spawn plus its queued mutations
apply together, keyed by the reserved token the host minted synchronously.
Structure edits reuse the same spawn / despawn / hierarchy path the
<for> reconciler uses, so layout, style and paint stay consistent. A
class, id, disabled or inline-style change marks the element
StyleDirty, and a structure edit
bumps StyleVersion; those are
what a host with a cascade of its own listens on. A host whose platform
resolves CSS itself, such as a browser page, has nothing reading them.
Structs§
- Pending
DomCommands - Commands gathered this tick, in issue order, for
apply_dom_commands.
Functions§
- apply_
dom_ commands - Apply the collected DOM / window commands against the live world.
- build_
dom_ index - Rebuild the per-tick
DomIndexsnapshot from the live tree and publish it for cross-thread readers (script hosts, the C-ABI). - collect_
dom_ commands - Collect this tick’s DOM / window commands from the script event stream
and the external bus into
PendingDomCommands, preserving order. - install_
dom - Install the dynamic DOM pipeline on
app.