Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/serious-cars-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: prevent last_propagated_event from being DCE'd
5 changes: 4 additions & 1 deletion packages/svelte/src/internal/client/dom/elements/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ export function handle_event_propagation(event) {
// mounted apps. In this case we don't want to trigger events multiple times.
var path_idx = 0;

// the `last_propagated_event === event` check is redundant, but
// without it the variable will be DCE'd and things will
// fail mysteriously in Firefox
// @ts-expect-error is added below
var handled_at = event.__root;
var handled_at = last_propagated_event === event && event.__root;

if (handled_at) {
var at_idx = path.indexOf(handled_at);
Expand Down
Loading