From d0d1a11bf1dde24c7f231d8750f8332e86dc7ae0 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 14 Nov 2023 20:10:30 -0500 Subject: [PATCH] treat `slot` the same as other props - closes #9455 --- .changeset/tiny-kings-whisper.md | 5 +++++ .../compiler/phases/3-transform/client/visitors/template.js | 1 - .../compiler/phases/3-transform/server/transform-server.js | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .changeset/tiny-kings-whisper.md diff --git a/.changeset/tiny-kings-whisper.md b/.changeset/tiny-kings-whisper.md new file mode 100644 index 0000000000..e1e5c3a01d --- /dev/null +++ b/.changeset/tiny-kings-whisper.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: treat `slot` the same as other props diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js index b4007e79fd..a8ac315934 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js @@ -710,7 +710,6 @@ function serialize_inline_component(node, component_name, context) { } else if (attribute.type === 'SpreadAttribute') { props_and_spreads.push(/** @type {import('estree').Expression} */ (context.visit(attribute))); } else if (attribute.type === 'Attribute') { - if (attribute.name === 'slot') continue; if (attribute.name.startsWith('--')) { custom_css_props.push( b.init(attribute.name, serialize_attribute_value(attribute.value, context)[1]) diff --git a/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js b/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js index f0800fedc6..794a52995e 100644 --- a/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js +++ b/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js @@ -782,7 +782,6 @@ function serialize_inline_component(node, component_name, context) { } else if (attribute.type === 'SpreadAttribute') { props_and_spreads.push(/** @type {import('estree').Expression} */ (context.visit(attribute))); } else if (attribute.type === 'Attribute') { - if (attribute.name === 'slot') continue; if (attribute.name.startsWith('--')) { const value = serialize_attribute_value(attribute.value, context, false, true); custom_css_props.push(b.init(attribute.name, value));