Skip to content

Commit 441124c

Browse files
authored
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
1 parent feb2d85 commit 441124c

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

.changeset/gentle-bulldogs-cough.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ensure SVG element attributes have case preserved

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function SvelteElement(node, context) {
101101
node,
102102
element_id,
103103
attributes_id,
104-
b.binary('!==', b.member(element_id, 'namespaceURI'), b.id('$.NAMESPACE_SVG')),
104+
b.binary('===', b.member(element_id, 'namespaceURI'), b.id('$.NAMESPACE_SVG')),
105105
b.call(b.member(b.member(element_id, 'nodeName'), 'includes'), b.literal('-')),
106106
context.state
107107
);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
html: `<svg viewBox="0 0 10 10"></svg><svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"></svg><svg viewBox=""></svg>`
5+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<svelte:options namespace="svg" />
2+
<svelte:element this="svg" viewBox="0 0 10 10" />
3+
<svelte:element this="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" />
4+
<svg viewBox="" />

0 commit comments

Comments
 (0)