From 441124c5c7d1bb35de9cb20377cddb4bad026eba Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Fri, 25 Oct 2024 20:29:44 +0100 Subject: [PATCH] fix: ensure SVG element attributes have case preserved (#13935) * fix: ensure SVG element attributes have case preserved * fix: ensure SVG element attributes have case preserved * fix: ensure SVG element attributes have case preserved --- .changeset/gentle-bulldogs-cough.md | 5 +++++ .../phases/3-transform/client/visitors/SvelteElement.js | 2 +- .../runtime-runes/samples/svg-attribute-case/_config.js | 5 +++++ .../runtime-runes/samples/svg-attribute-case/main.svelte | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/gentle-bulldogs-cough.md create mode 100644 packages/svelte/tests/runtime-runes/samples/svg-attribute-case/_config.js create mode 100644 packages/svelte/tests/runtime-runes/samples/svg-attribute-case/main.svelte diff --git a/.changeset/gentle-bulldogs-cough.md b/.changeset/gentle-bulldogs-cough.md new file mode 100644 index 000000000000..3f6f86225915 --- /dev/null +++ b/.changeset/gentle-bulldogs-cough.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: ensure SVG element attributes have case preserved diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js index d95f03d1d47c..ba66fe29d691 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js @@ -101,7 +101,7 @@ export function SvelteElement(node, context) { node, element_id, attributes_id, - b.binary('!==', b.member(element_id, 'namespaceURI'), b.id('$.NAMESPACE_SVG')), + b.binary('===', b.member(element_id, 'namespaceURI'), b.id('$.NAMESPACE_SVG')), b.call(b.member(b.member(element_id, 'nodeName'), 'includes'), b.literal('-')), context.state ); diff --git a/packages/svelte/tests/runtime-runes/samples/svg-attribute-case/_config.js b/packages/svelte/tests/runtime-runes/samples/svg-attribute-case/_config.js new file mode 100644 index 000000000000..a863250c74bc --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/svg-attribute-case/_config.js @@ -0,0 +1,5 @@ +import { test } from '../../test'; + +export default test({ + html: `` +}); diff --git a/packages/svelte/tests/runtime-runes/samples/svg-attribute-case/main.svelte b/packages/svelte/tests/runtime-runes/samples/svg-attribute-case/main.svelte new file mode 100644 index 000000000000..58324633123e --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/svg-attribute-case/main.svelte @@ -0,0 +1,4 @@ + + + + \ No newline at end of file