Skip to content

Commit c9e9e90

Browse files
authored
fix: always close tags when namespace is foreign (#12623)
1 parent 32af943 commit c9e9e90

File tree

2 files changed

+4
-2
lines changed
  • packages/svelte
    • src/compiler/phases/3-transform/server/visitors
    • tests/runtime-legacy/samples/attribute-casing-foreign-namespace

2 files changed

+4
-2
lines changed

packages/svelte/src/compiler/phases/3-transform/server/visitors/RegularElement.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function RegularElement(node, context) {
9595
);
9696
}
9797

98-
if (!VoidElements.includes(node.name) && namespace !== 'foreign') {
98+
if (!VoidElements.includes(node.name) || namespace === 'foreign') {
9999
state.template.push(b.literal(`</${node.name}>`));
100100
}
101101

packages/svelte/tests/runtime-legacy/samples/attribute-casing-foreign-namespace/_config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { test } from '../../test';
22

33
export default test({
4-
skip: true, // TODO: needs fixing
4+
// TODO: needs fixing. Can only be fixed once we also support document.createElementNS-style creation of elements
5+
// because the $.template('...') approach has no option to preserve attribute name casing
6+
skip: true,
57

68
html: `
79
<page horizontalAlignment="center">

0 commit comments

Comments
 (0)