Skip to content

Commit 4761a1c

Browse files
committed
handle <title> ambiguity the same as <a>
1 parent 4e5e1ec commit 4761a1c

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ export function RegularElement(node, context) {
9090
if (is_svg(node.name)) {
9191
return true;
9292
}
93-
if (node.name === 'a') {
94-
for (let i = context.path.length - 1; i >= 0; i--) {
93+
94+
if (node.name === 'a' || node.name === 'title') {
95+
let i = context.path.length;
96+
97+
while (i--) {
9598
const ancestor = context.path[i];
9699
if (ancestor.type === 'RegularElement') {
97100
return ancestor.metadata.svg;

packages/svelte/src/compiler/phases/3-transform/utils.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,6 @@ export function infer_namespace(namespace, parent, nodes) {
347347
}
348348
}
349349

350-
// If the parent block is a control block, we want to keep the namespace if it's not html
351-
if (
352-
namespace !== 'html' &&
353-
(parent.type === 'IfBlock' ||
354-
parent.type === 'EachBlock' ||
355-
parent.type === 'AwaitBlock' ||
356-
parent.type === 'KeyBlock')
357-
) {
358-
return namespace;
359-
}
360-
361350
/** @type {Namespace | null} */
362351
let new_namespace = null;
363352

0 commit comments

Comments
 (0)