Skip to content

5.12 regression - namespace-ambigous elements like <a> in blocks are not rendered in SVG namespaceΒ #14723

@yagebu

Description

@yagebu

Describe the bug

The change in #14685 seems to have broken links in blocks within SVGs. Looking at that change, it now infers a "html" namespace (in the else branch) for the <a> as it's not clear from the <a> node itself which namespace it should have.

<svg>
	{#if true}
		<a href="/docs">
			<text x="20" y="40" class="small">{name}</text>
		</a>
	{/if}
</svg>

See playground links below for a reproduction.

A possible temporary workaround is to add a <g> wrapper element

Reproduction

Broken in
https://svelte.dev/playground/c498e7e6bb884b379bf1350e141c85dc
Since
https://svelte.dev/playground/c498e7e6bb884b379bf1350e141c85dc?version=5.12.0
Still worked in
https://svelte.dev/playground/c498e7e6bb884b379bf1350e141c85dc?version=5.11.3

Logs

No response

System Info

n/a, see REPL (Tested in Firefox)

Severity

blocking an upgrade

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions