Skip to content

Commit

Permalink
🐛 Fixed bug where morphing existing DOM nodes could cause crashes wit…
Browse files Browse the repository at this point in the history
…h events.
  • Loading branch information
hayleigh-dot-dev committed Oct 14, 2023
1 parent 5e40f3e commit dbf232a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime.ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit dbf232a

Please sign in to comment.