From 0758e1e9b411550d29243bd87bd308fe383bc0ff Mon Sep 17 00:00:00 2001 From: setop Date: Sun, 5 Oct 2025 01:39:20 +0200 Subject: [PATCH] feat: handle innerHTML --- dom.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dom.js b/dom.js index 7caac64..29963c2 100644 --- a/dom.js +++ b/dom.js @@ -2,7 +2,6 @@ function Node(parent, tag) { this.parentNode = parent; // Node this.pos = 0; // position in siblings list this.tagName = tag; - this.text = null; // attributes are stored directly on the node object // see https://github.com/elm/virtual-dom/blob/master/src/Elm/Kernel/VirtualDom.js#L511 this.children = []; // List of Node @@ -17,10 +16,14 @@ function Node(parent, tag) { node.pos = this.children.push(node); } this.dump = (d=0) => { - if (this.text != null) { + if (this.text) { print(this.text); return } + if (this.innerHTML) { + print(this.innerHTML); + return + } std.printf("<%s", this.tagName) // Set.difference(other) is not avalable in qjs for (a of Object.keys(this)) { @@ -53,6 +56,8 @@ document.getElementById = (_id) => { return target} document.createElement = (tag) => new Node(null, tag); document.createTextNode = (text) => { t = new Node(null, "#text" ); t.text = text; return t } +var global = {}; + try { // here will come the Elm app code