Skip to content

Commit 961c36b

Browse files
committed
fix
1 parent a3f7ae8 commit 961c36b

File tree

1 file changed

+14
-1
lines changed
  • packages/svelte/src/compiler/phases/3-transform/server/visitors/shared

1 file changed

+14
-1
lines changed

packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,26 @@ export function build_element_attributes(node, context) {
163163
])
164164
);
165165
} else {
166+
/** @type {Expression} */
167+
let expression = attribute.expression;
168+
169+
if (attribute.type === 'BindDirective' && expression.type === 'SequenceExpression') {
170+
const getter = expression.expressions[0];
171+
expression =
172+
getter.type === 'ArrowFunctionExpression' &&
173+
getter.params.length === 0 &&
174+
getter.body.type !== 'BlockStatement'
175+
? getter.body
176+
: b.call(getter);
177+
}
178+
166179
attributes.push(
167180
create_attribute(attribute.name, -1, -1, [
168181
{
169182
type: 'ExpressionTag',
170183
start: -1,
171184
end: -1,
172-
expression: attribute.expression,
185+
expression,
173186
metadata: {
174187
expression: create_expression_metadata()
175188
}

0 commit comments

Comments
 (0)