diff --git a/.changeset/real-onions-confess.md b/.changeset/real-onions-confess.md index 25193ace4e..06e07fd222 100644 --- a/.changeset/real-onions-confess.md +++ b/.changeset/real-onions-confess.md @@ -2,4 +2,4 @@ 'svelte': patch --- -fix: ensure logic blocks keep consitent namespacing +fix: ensure logic blocks keep consistent namespacing diff --git a/packages/svelte/src/compiler/phases/3-transform/utils.js b/packages/svelte/src/compiler/phases/3-transform/utils.js index bdf4baf038..fdb4c579be 100644 --- a/packages/svelte/src/compiler/phases/3-transform/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/utils.js @@ -350,7 +350,10 @@ export function infer_namespace(namespace, parent, nodes) { // If the parent block is a control block, we want to keep the namespace if it's not html if ( namespace !== 'html' && - (parent.type === 'EachBlock' || parent.type === 'AwaitBlock' || parent.type === 'KeyBlock') + (parent.type === 'IfBlock' || + parent.type === 'EachBlock' || + parent.type === 'AwaitBlock' || + parent.type === 'KeyBlock') ) { return namespace; }