From fe9d1317dbda8ed10ea8cd392a51c3e83effb120 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Thu, 14 Mar 2024 06:57:16 +0100 Subject: :bug: Fixed bug where empty string attributes did not work at runtime. --- src/vdom.ffi.mjs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/vdom.ffi.mjs b/src/vdom.ffi.mjs index 0e5cd70..e090612 100644 --- a/src/vdom.ffi.mjs +++ b/src/vdom.ffi.mjs @@ -46,7 +46,7 @@ export function morph(prev, curr, dispatch, parent) { "function should only be called internally by lustre's runtime: if you think", "this is an error, please open an issue at", "https://github.com/hayleigh-dot-dev/gleam-lustre/issues/new", - ].join(" "), + ].join(" ") ); } @@ -190,7 +190,7 @@ function morphElement(prev, curr, dispatch, parent) { ) { currAttrs.set( currAttr[0], - `${currAttrs.get("dangerous-unescaped-html")} ${currAttr[1]}`, + `${currAttrs.get("dangerous-unescaped-html")} ${currAttr[1]}` ); } else if (currAttr[0] !== "") { currAttrs.set(currAttr[0], currAttr[1]); @@ -317,11 +317,7 @@ function morphAttr(el, name, value, dispatch) { case "string": if (name === "value") el.value = value; - if (value === "") { - el.removeAttribute(name); - } else { - el.setAttribute(name, value); - } + el.setAttribute(name, value); break; -- cgit v1.2.3