aboutsummaryrefslogtreecommitdiff
path: root/src/vdom.ffi.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-03-14 06:57:16 +0100
committerHayleigh Thompson <me@hayleigh.dev>2024-03-14 06:57:16 +0100
commitfe9d1317dbda8ed10ea8cd392a51c3e83effb120 (patch)
tree50d91024b448bf35ebe2620ccf0eeeb5f003d43f /src/vdom.ffi.mjs
parentb53ab020043985de63e81c04cee7f69ee08c7e18 (diff)
downloadlustre-fe9d1317dbda8ed10ea8cd392a51c3e83effb120.tar.gz
lustre-fe9d1317dbda8ed10ea8cd392a51c3e83effb120.zip
:bug: Fixed bug where empty string attributes did not work at runtime.
Diffstat (limited to 'src/vdom.ffi.mjs')
-rw-r--r--src/vdom.ffi.mjs10
1 files changed, 3 insertions, 7 deletions
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;