diff --git a/.changeset/pretty-trees-prove.md b/.changeset/pretty-trees-prove.md new file mode 100644 index 000000000000..9c5cdfa7134e --- /dev/null +++ b/.changeset/pretty-trees-prove.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: use non-destructive hydration for all `@html` tags diff --git a/packages/svelte/src/compiler/compile/render_dom/wrappers/RawMustacheTag.js b/packages/svelte/src/compiler/compile/render_dom/wrappers/RawMustacheTag.js index 11a838ab8e95..cc382a9b0bb1 100644 --- a/packages/svelte/src/compiler/compile/render_dom/wrappers/RawMustacheTag.js +++ b/packages/svelte/src/compiler/compile/render_dom/wrappers/RawMustacheTag.js @@ -26,7 +26,7 @@ export default class RawMustacheTagWrapper extends Tag { render(block, parent_node, _parent_nodes) { const in_head = is_head(parent_node); const can_use_innerhtml = !in_head && parent_node && !this.prev && !this.next; - if (can_use_innerhtml) { + if (can_use_innerhtml && !this.renderer.options.hydratable) { /** @param {import('estree').Node} content */ const insert = (content) => b`${parent_node}.innerHTML = ${content};`[0]; const { init } = this.rename_this_method(block, (content) => insert(content));