Skip to content

Commit 7b2279d

Browse files
authored
chore: tidy up dynamic event handler generated code (#12553)
* chore: tidy up dynamic event handler generated code * actually we need a proper function
1 parent e2b75d1 commit 7b2279d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/calm-cameras-hide.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+
chore: tidy up dynamic event handler generated code

packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,12 @@ function serialize_event_handler(node, { state, visit }) {
11371137
null,
11381138
[b.rest(b.id('$$args'))],
11391139
b.block([
1140-
b.const('$$callback', /** @type {Expression} */ (visit(handler))),
11411140
b.return(
1142-
b.call(b.member(b.id('$$callback'), b.id('apply'), false, true), b.this, b.id('$$args'))
1141+
b.call(
1142+
b.member(/** @type {Expression} */ (visit(handler)), b.id('apply'), false, true),
1143+
b.this,
1144+
b.id('$$args')
1145+
)
11431146
)
11441147
])
11451148
);

0 commit comments

Comments
 (0)