From ebe803ff37a5307f35d14fa45f823dbb5017273a Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Fri, 26 Jul 2024 20:52:24 +0200 Subject: [PATCH 1/2] fix: never set custom element props as attributes --- .../compiler/phases/3-transform/client/visitors/template.js | 1 + .../samples/attribute-custom-element-inheritance/_config.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) 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 3e8fff654f6d..0548d7a1432c 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 @@ -2152,6 +2152,7 @@ export const template_visitors = { } if ( + !is_custom_element && attribute.name !== 'autofocus' && (attribute.value === true || is_text_attribute(attribute)) ) { diff --git a/packages/svelte/tests/runtime-legacy/samples/attribute-custom-element-inheritance/_config.js b/packages/svelte/tests/runtime-legacy/samples/attribute-custom-element-inheritance/_config.js index 0b5365a9f1f3..396048c91acc 100644 --- a/packages/svelte/tests/runtime-legacy/samples/attribute-custom-element-inheritance/_config.js +++ b/packages/svelte/tests/runtime-legacy/samples/attribute-custom-element-inheritance/_config.js @@ -1,8 +1,7 @@ import { test } from '../../test'; export default test({ - skip: true, // TODO: needs fixing - + mode: ['client'], html: ` Hello World! ` From 4b68831f012c07d0f6e656f4c1910267d8c72735 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 26 Jul 2024 15:58:18 -0400 Subject: [PATCH 2/2] changeset --- .changeset/fifty-toys-invite.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fifty-toys-invite.md diff --git a/.changeset/fifty-toys-invite.md b/.changeset/fifty-toys-invite.md new file mode 100644 index 000000000000..2dd19c3b0431 --- /dev/null +++ b/.changeset/fifty-toys-invite.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: never set custom element props as attributes inside templates