diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2023-09-22 18:45:49 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2023-09-22 18:45:49 +0100 |
commit | c8142aba0f559b41507e9b68397ad6d18f0abadc (patch) | |
tree | 3de8a9526f897e177301821caaa758cbe82ff955 | |
parent | f2bd623c7ddd16a0b615447b831a3392f5dcfa3f (diff) | |
download | lustre-c8142aba0f559b41507e9b68397ad6d18f0abadc.tar.gz lustre-c8142aba0f559b41507e9b68397ad6d18f0abadc.zip |
:bug: Fixed a bug where falsy text nodes were never rendered.
-rw-r--r-- | src/runtime.ffi.mjs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/runtime.ffi.mjs b/src/runtime.ffi.mjs index dd02f8b..9b61ee5 100644 --- a/src/runtime.ffi.mjs +++ b/src/runtime.ffi.mjs @@ -16,7 +16,7 @@ export function morph(prev, curr, dispatch, parent) { : createElement(prev, curr, null, dispatch, parent); } - if (curr[0] && typeof curr[0] === "string") { + if (typeof curr?.[0] === "string") { return prev?.nodeType === 3 ? morphText(prev, curr) : createText(prev, curr); @@ -213,11 +213,6 @@ function morphAttr(el, name, value, dispatch) { // TEXT ------------------------------------------------------------------------ function createText(prev, curr) { - if (!curr[0]) { - prev?.remove(); - return null; - } - const el = document.createTextNode(curr[0]); if (prev) prev.replaceWith(el); |