Skip to content

Commit 8a6810d

Browse files
committed
attempt getting attachments from spreadelement
1 parent 3ad1e0a commit 8a6810d

File tree

1 file changed

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

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ export function build_component(node, component_name, context, anchor = context.
165165
} else {
166166
props_and_spreads.push(expression);
167167
}
168+
169+
// Handle attachments from spread attributes
170+
const symbol = b.call('Symbol.for', b.literal('svelte.attachments'));
171+
const member = b.member(expression, symbol, true); // computed property
172+
const default_empty = b.array([]);
173+
const attachments_expr = b.logical('??', member, default_empty);
174+
175+
all_attachments.push(b.spread(attachments_expr));
168176
} else if (attribute.type === 'Attribute') {
169177
if (attribute.name.startsWith('--')) {
170178
custom_css_props.push(

0 commit comments

Comments
 (0)