fix: reevaluate namespace in slots (#11849)

Closes #11847
pull/11850/head
Paolo Ricciuti 7 months ago committed by GitHub
parent e4faa7805d
commit 7e762cf481
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: reevaluate namespace in slots

@ -176,7 +176,8 @@ export function infer_namespace(namespace, parent, nodes) {
parent.type === 'Component' ||
parent.type === 'SvelteComponent' ||
parent.type === 'SvelteFragment' ||
parent.type === 'SnippetBlock'
parent.type === 'SnippetBlock' ||
parent.type === 'SlotElement'
) {
const new_namespace = check_nodes_for_namespace(nodes, 'keep');
if (new_namespace !== 'keep' && new_namespace !== 'maybe_html') {

@ -0,0 +1,9 @@
import { ok, test } from '../../test';
export default test({
async test({ assert, target }) {
const circle = target.querySelector('circle');
ok(circle);
assert.equal(circle.namespaceURI, 'http://www.w3.org/2000/svg');
}
});

@ -0,0 +1,7 @@
<script>
import Points from './points.svelte';
</script>
<svg>
<Points />
</svg>

@ -0,0 +1,3 @@
<slot>
<circle cx={10} cy={10} r={5} />
</slot>
Loading…
Cancel
Save