diff --git a/packages/interpreter/src/bindings.rs b/packages/interpreter/src/bindings.rs index 3f0dc5ce1..a08ef9c13 100644 --- a/packages/interpreter/src/bindings.rs +++ b/packages/interpreter/src/bindings.rs @@ -17,6 +17,9 @@ extern "C" { #[wasm_bindgen(method)] pub fn PushRoot(this: &Interpreter, root: u64); + #[wasm_bindgen(method)] + pub fn PopRoot(this: &Interpreter); + #[wasm_bindgen(method)] pub fn AppendChildren(this: &Interpreter, many: u32); diff --git a/packages/interpreter/src/interpreter.js b/packages/interpreter/src/interpreter.js index 273b0a9df..4725fff31 100644 --- a/packages/interpreter/src/interpreter.js +++ b/packages/interpreter/src/interpreter.js @@ -27,6 +27,9 @@ export class Interpreter { const node = this.nodes[root]; this.stack.push(node); } + PopRoot() { + this.stack.pop(); + } AppendChildren(many) { let root = this.stack[this.stack.length - (1 + many)]; let to_add = this.stack.splice(this.stack.length - many); diff --git a/packages/web/src/dom.rs b/packages/web/src/dom.rs index c2bf38df0..390c7800c 100644 --- a/packages/web/src/dom.rs +++ b/packages/web/src/dom.rs @@ -105,6 +105,7 @@ impl WebsysDom { for edit in edits.drain(..) { match edit { DomEdit::PushRoot { root } => self.interpreter.PushRoot(root), + DomEdit::PopRoot {} => self.interpreter.PopRoot(), DomEdit::AppendChildren { many } => self.interpreter.AppendChildren(many), DomEdit::ReplaceWith { root, m } => self.interpreter.ReplaceWith(root, m), DomEdit::InsertAfter { root, n } => self.interpreter.InsertAfter(root, n),