diff options
-rw-r--r-- | lib/src/runtime.ffi.mjs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/src/runtime.ffi.mjs b/lib/src/runtime.ffi.mjs index 36b6f4a..0994231 100644 --- a/lib/src/runtime.ffi.mjs +++ b/lib/src/runtime.ffi.mjs @@ -1,26 +1,21 @@ -import { element, namespaced, text } from "./lustre/element.mjs"; import { List, Empty } from "./gleam.mjs"; import { Some, None } from "../gleam_stdlib/gleam/option.mjs"; -const Element = element("").constructor; -const ElementNs = namespaced("", "").constructor; -const Text = text("").constructor; - export function morph(prev, curr, parent) { - if (curr instanceof ElementNs) + if (curr[3]) return prev?.nodeType === 1 && prev.nodeName === curr[0].toUpperCase() && prev.namespaceURI === curr[3] ? morphElement(prev, curr, curr[3], parent) : createElement(prev, curr, curr[3], parent); - if (curr instanceof Element) { + if (curr[2]) { return prev?.nodeType === 1 && prev.nodeName === curr[0].toUpperCase() ? morphElement(prev, curr, null, parent) : createElement(prev, curr, null, parent); } - if (curr instanceof Text) { + if (curr[0]) { return prev?.nodeType === 3 ? morphText(prev, curr) : createText(prev, curr); |