Skip to content

Commit 8a29715

Browse files
committed
actually we need a proper function
1 parent 3558100 commit 8a29715

File tree

1 file changed

+12
-8
lines changed
  • packages/svelte/src/compiler/phases/3-transform/client/visitors

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,16 +1139,20 @@ function serialize_event_handler(node, { state, visit }) {
11391139
handler = node.expression;
11401140

11411141
// Event handlers can be dynamic (source/store/prop/conditional etc)
1142-
const dynamic_handler = () => {
1143-
return b.arrow(
1142+
const dynamic_handler = () =>
1143+
b.function(
1144+
null,
11441145
[b.rest(b.id('$$args'))],
1145-
b.call(
1146-
b.member(/** @type {Expression} */ (visit(handler)), b.id('apply'), false, true),
1147-
b.this,
1148-
b.id('$$args')
1149-
)
1146+
b.block([
1147+
b.return(
1148+
b.call(
1149+
b.member(/** @type {Expression} */ (visit(handler)), b.id('apply'), false, true),
1150+
b.this,
1151+
b.id('$$args')
1152+
)
1153+
)
1154+
])
11501155
);
1151-
};
11521156

11531157
if (handler.type === 'Identifier' || handler.type === 'MemberExpression') {
11541158
const id = object(handler);

0 commit comments

Comments
 (0)