From c8142aba0f559b41507e9b68397ad6d18f0abadc Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Fri, 22 Sep 2023 18:45:49 +0100 Subject: :bug: Fixed a bug where falsy text nodes were never rendered. --- src/runtime.ffi.mjs | 7 +------ 1 file changed, 1 insertion(+), 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); -- cgit v1.2.3