Skip to content

Commit 1fe0152

Browse files
authored
fix: delegate events on elements with bind-this (#9696)
fixes #9688
1 parent 2416587 commit 1fe0152

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/chatty-taxis-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: delegate events on elements with bind-this

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,8 @@ function determine_element_spread_and_delegatable(node) {
11061106
has_spread = true;
11071107
} else if (
11081108
!has_action_or_bind &&
1109-
(attribute.type === 'BindDirective' || attribute.type === 'UseDirective')
1109+
((attribute.type === 'BindDirective' && attribute.name !== 'this') ||
1110+
attribute.type === 'UseDirective')
11101111
) {
11111112
has_action_or_bind = true;
11121113
}

0 commit comments

Comments
 (0)