Skip to content

Commit 0ae74d9

Browse files
committed
fix: delegate events on elements with bind-this
fixes #9688
1 parent 3e3ae92 commit 0ae74d9

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
@@ -1094,7 +1094,8 @@ function determine_element_spread_and_delegatable(node) {
10941094
has_spread = true;
10951095
} else if (
10961096
!has_action_or_bind &&
1097-
(attribute.type === 'BindDirective' || attribute.type === 'UseDirective')
1097+
((attribute.type === 'BindDirective' && attribute.name !== 'this') ||
1098+
attribute.type === 'UseDirective')
10981099
) {
10991100
has_action_or_bind = true;
11001101
}

0 commit comments

Comments
 (0)