diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index ef330224027e..cd46da82d806 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -384,7 +384,7 @@ export default class ElementWrapper extends Wrapper { this.add_classes(block); this.add_manual_style_scoping(block); - if (nodes && this.renderer.options.hydratable && !this.void) { + if (nodes && this.renderer.options.hydratable && !this.void && !this.can_use_innerhtml) { block.chunks.claim.push( b`${this.node.children.length > 0 ? nodes : children}.forEach(@detach);` ); diff --git a/src/compiler/compile/render_dom/wrappers/shared/Wrapper.ts b/src/compiler/compile/render_dom/wrappers/shared/Wrapper.ts index 4bf8c20bd876..96cf65756d8f 100644 --- a/src/compiler/compile/render_dom/wrappers/shared/Wrapper.ts +++ b/src/compiler/compile/render_dom/wrappers/shared/Wrapper.ts @@ -35,7 +35,7 @@ export default class Wrapper { } }); - this.can_use_innerhtml = !renderer.options.hydratable; + this.can_use_innerhtml = true; this.is_static_content = !renderer.options.hydratable; block.wrappers.push(this); diff --git a/test/hydration/samples/static-content/_after.html b/test/hydration/samples/static-content/_after.html new file mode 100644 index 000000000000..b422f2de2a55 --- /dev/null +++ b/test/hydration/samples/static-content/_after.html @@ -0,0 +1,5 @@ +
Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
+Hello world
`; + }, + l(nodes) { + div = claim_element(nodes, "DIV", {}); + var div_nodes = children(div); + }, + m(target, anchor) { + insert(target, div, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(div); + } + }; +} + +class Component extends SvelteComponent { + constructor(options) { + super(); + init(this, options, null, create_fragment, safe_not_equal, {}); + } +} + +export default Component; \ No newline at end of file diff --git a/test/js/samples/hydrating-static-content/input.svelte b/test/js/samples/hydrating-static-content/input.svelte new file mode 100644 index 000000000000..0429a0a1d2aa --- /dev/null +++ b/test/js/samples/hydrating-static-content/input.svelte @@ -0,0 +1,5 @@ +Hello world
+Hello world
+Hello world
+