aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2023-10-14 12:39:51 +0100
committerHayleigh Thompson <me@hayleigh.dev>2023-10-14 12:39:51 +0100
commitdbf232acb059f9f3f8972242b68a9384b1290dd4 (patch)
tree9f95fadebc08a5c91070dc3f13e9dcf69fa04e25
parent5e40f3e0388f865631e82f910f2a90dd9edad741 (diff)
downloadlustre-v3.0.7.tar.gz
lustre-v3.0.7.zip
:bug: Fixed bug where morphing existing DOM nodes could cause crashes with events.v3.0.7
-rw-r--r--src/runtime.ffi.mjs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime.ffi.mjs b/src/runtime.ffi.mjs
index bbc76b4..28516ac 100644
--- a/src/runtime.ffi.mjs
+++ b/src/runtime.ffi.mjs
@@ -90,6 +90,10 @@ function morphElement(prev, curr, ns, dispatch, parent) {
const prevAttrs = prev.attributes;
const currAttrs = new Map();
+ // This can happen if we're morphing an existing DOM element that *wasn't*
+ // initially created by lustre.
+ prev.$lustre ??= {};
+
let currAttr = curr[1];
while (currAttr.head) {
if (currAttr.head[0] === "class" && currAttrs.has("class")) {