pub enum DomOp {
Show 29 variants
CreateElement {
node: u32,
tag: String,
},
CreateTextNode {
node: u32,
text: String,
},
SetText {
node: u32,
text: String,
},
SetHtml {
node: u32,
html: String,
},
ClearChildren {
node: u32,
},
SetAttribute {
node: u32,
name: String,
value: String,
},
AppendChild {
parent: u32,
child: u32,
},
SetValue {
node: u32,
value: String,
},
SetStream {
node: u32,
stream: i64,
},
RtcPeerConnection {
pc: u32,
},
RtcDataChannel {
pc: u32,
channel: u32,
label: String,
},
RtcCreateOffer {
pc: u32,
},
RtcCreateAnswer {
pc: u32,
},
RtcSetLocal {
pc: u32,
sdp: String,
},
RtcSetRemote {
pc: u32,
sdp: String,
},
RtcAddIce {
pc: u32,
candidate: String,
},
RtcSend {
channel: u32,
bytes: u64,
},
AddEventListener {
node: u32,
event: String,
},
SetChecked {
node: u32,
checked: bool,
},
PreventDefault {
node: u32,
event: String,
},
RemoveNode {
node: u32,
},
InsertBefore {
parent: u32,
child: u32,
before: u32,
},
RemoveAttribute {
node: u32,
name: String,
},
Adopt {
parent: u32,
node: u32,
tag: String,
},
AdoptText {
parent: u32,
node: u32,
text: String,
},
Listen {
node: u32,
event: String,
flags: u8,
},
Unlisten {
node: u32,
event: String,
},
FreeNode {
node: u32,
},
Hydrate {
root: u32,
},
}Expand description
One recorded DOM mutation. Nodes are referenced by their creation ordinal
(the handle, assigned sequentially from 0 = body), so op-logs compare
equal across tiers regardless of how each tier numbers its handles internally.
Variants§
CreateElement
CreateTextNode
SetText
SetHtml
ClearChildren
SetAttribute
AppendChild
SetValue
SetStream
Attach an opaque host media stream (a MediaStream handle) to an element’s srcObject —
the primitive that renders a peer’s live video/audio in a <video>/<audio> tile.
RtcPeerConnection
RtcDataChannel
RtcCreateOffer
RtcCreateAnswer
RtcSetLocal
RtcSetRemote
RtcAddIce
RtcSend
AddEventListener
SetChecked
setChecked(el, on) — a checkbox’s or radio’s CHECKED state.
Deliberately not a SetAttribute. In HTML checked is a PRESENCE, and in the DOM it is
two different things: the ATTRIBUTE is defaultChecked (what the box returns to on a form
reset) while the live state a visitor sees and a form submits is the PROPERTY. Writing the
attribute therefore leaves a box the page believes is checked drawn unchecked. Carrying it
as a boolean op means both tiers agree on presence and absence rather than on a string, and
checked="false" — which every browser reads as CHECKED — is unspellable.
PreventDefault
★ THIS LISTENER CANCELS THE BROWSER’S OWN ACTION for event on node.
on-submit.prevent={save} means the page handles the submit and the browser must not ALSO
post the form — otherwise the request goes twice, once to the handler and once to the
server, which is the duplicate-submission bug every form library exists to avoid. It is a
property of the REGISTRATION, not of the event, so it is recorded where the listener is
attached rather than discovered when one fires.
RemoveNode
Detach a node from wherever it currently lives — the single-node counterpart to
ClearChildren, so a keyed diff drops exactly the rows it stopped rendering instead of
tearing down and rebuilding the whole parent.
InsertBefore
Move child under parent, immediately before before — or last, when before is
u32::MAX (the same “no such element” sentinel documented in patch.rs; handle 0 is
body here, so it cannot double as the “append” marker). The op a keyed reorder’s minimal
move set is built from: child keeps its identity, so a reused row keeps whatever focus,
selection or typed value it already carries.
RemoveAttribute
Remove an attribute a new render dropped — the deletion SetAttribute cannot express.
Adopt
Bind node to the next element under parent that the markup a DomOp::Hydrate opened
already holds, when its tag is tag; an element of another tag, or none, is a mismatch the
stream’s apply counts, and node stays unbound.
AdoptText
Bind node to its place in the run of text the markup holds under parent before the next
adopted element, holding text. The run is split along its claims when they spell it and
rebuilt when they do not: a text node carries nothing a visitor did to it.
Listen
Register event on node with a bitmask of behavioural modifiers (.prevent / .stop
/ .once / .capture / .passive) — the generalisation AddEventListener /
PreventDefault predate, carrying every modifier in one registration rather than one op
per behaviour.
Unlisten
Remove a listener a new render dropped.
FreeNode
Detach node from its parent AND release the id of node and EVERY descendant — the
document-side half of heap reclamation, and ONE op per removed subtree root regardless of
its size: a 1,000-row list clear is 1,000 FreeNodes, not a FreeNode per node. The host
walks the (about to be detached) subtree once, deleting each id from its own node table,
rather than the emitter naming every descendant — a descendant has no RemoveNode/
FreeNode of its own; removing/freeing its ancestor is what removes/frees it.
Hydrate
Open a hydration of root: the markup it holds is the page’s first paint, drawn before the
program ran, and the stream’s Adopt/AdoptText claim its nodes instead of creating them.
When the stream ends, whatever the markup holds that no claim bound is removed.
Trait Implementations§
impl Eq for DomOp
impl StructuralPartialEq for DomOp
Auto Trait Implementations§
impl Freeze for DomOp
impl RefUnwindSafe for DomOp
impl Send for DomOp
impl Sync for DomOp
impl Unpin for DomOp
impl UnsafeUnpin for DomOp
impl UnwindSafe for DomOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.