diff options
-rw-r--r-- | lib/src/lustre.ffi.mjs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/src/lustre.ffi.mjs b/lib/src/lustre.ffi.mjs index 10524e0..520a3ae 100644 --- a/lib/src/lustre.ffi.mjs +++ b/lib/src/lustre.ffi.mjs @@ -35,12 +35,12 @@ export class App { if (!is_browser()) return new Error(new NotABrowser()); if (this.#root) return new Error(new AppAlreadyStarted()); - this.$root = + this.#root = selector instanceof HTMLElement ? selector : document.querySelector(selector); - if (!this.$root) return new Error(new ElementNotFound()); + if (!this.#root) return new Error(new ElementNotFound()); const [next, effects] = this.#init(flags); @@ -84,7 +84,7 @@ export class App { const node = this.#view(this.#state); const vdom = map(node, (msg) => this.dispatch(msg)); - this.#root = morph(this.#root, vdom); + this.#root = morph(this.#root, vdom, this.#root.parentNode); } #tick() { |