Skip to content

Commit 728f033

Browse files
committed
fix: ensure logic blocks keep consitent namespacing
1 parent 1d773ef commit 728f033

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/real-onions-confess.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 logic blocks keep consitent namespacing

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@ 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 === 'EachBlock' || parent.type === 'AwaitBlock' || parent.type === 'KeyBlock')
354+
) {
355+
return namespace;
356+
}
357+
350358
/** @type {Namespace | null} */
351359
let new_namespace = null;
352360

0 commit comments

Comments
 (0)