Skip to content

Commit 012cdeb

Browse files
committed
fix
1 parent 028dba8 commit 012cdeb

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

packages/svelte/src/internal/client/dom/blocks/each.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ function create_item(
637637
try {
638638
if (anchor === null) {
639639
var fragment = document.createDocumentFragment();
640-
fragment.append((anchor = document.createComment('')));
640+
fragment.append((anchor = create_text()));
641641
}
642642

643643
item.e = branch(() => render_fn(/** @type {Node} */ (anchor), v, i, get_collection), hydrating);

packages/svelte/src/internal/client/dom/blocks/if.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { block, branch, pause_effect, resume_effect } from '../../reactivity/eff
1212
import { HYDRATION_START_ELSE, UNINITIALIZED } from '../../../../constants.js';
1313
import { active_effect } from '../../runtime.js';
1414
import { add_boundary_callback, find_boundary } from './boundary.js';
15-
import { should_defer_append } from '../operations.js';
15+
import { create_text, should_defer_append } from '../operations.js';
1616

1717
/**
1818
* @param {TemplateNode} node
@@ -115,7 +115,7 @@ export function if_block(node, fn, elseif = false) {
115115

116116
if (defer) {
117117
offscreen_fragment = document.createDocumentFragment();
118-
offscreen_fragment.append((target = document.createComment('')));
118+
offscreen_fragment.append((target = create_text()));
119119
}
120120

121121
if (condition ? !consequent_effect : !alternate_effect) {
@@ -124,6 +124,7 @@ export function if_block(node, fn, elseif = false) {
124124

125125
if (defer) {
126126
add_boundary_callback(boundary, commit);
127+
target.remove();
127128
} else {
128129
commit();
129130
}

packages/svelte/src/internal/client/dom/blocks/key.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { active_effect } from '../../runtime.js';
66
import { is_runes } from '../../context.js';
77
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
88
import { add_boundary_callback, find_boundary } from './boundary.js';
9-
import { should_defer_append } from '../operations.js';
9+
import { create_text, should_defer_append } from '../operations.js';
1010

1111
/**
1212
* @template V
@@ -62,13 +62,14 @@ export function key_block(node, get_key, render_fn) {
6262

6363
if (defer) {
6464
offscreen_fragment = document.createDocumentFragment();
65-
offscreen_fragment.append((target = document.createComment('')));
65+
offscreen_fragment.append((target = create_text()));
6666
}
6767

6868
pending_effect = branch(() => render_fn(target));
6969

7070
if (defer) {
7171
add_boundary_callback(boundary, commit);
72+
target.remove();
7273
} else {
7374
commit();
7475
}

packages/svelte/src/internal/client/dom/blocks/svelte-component.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EFFECT_TRANSPARENT } from '../../constants.js';
33
import { block, branch, pause_effect } from '../../reactivity/effects.js';
44
import { active_effect } from '../../runtime.js';
55
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
6-
import { should_defer_append } from '../operations.js';
6+
import { create_text, should_defer_append } from '../operations.js';
77
import { add_boundary_callback, find_boundary } from './boundary.js';
88

99
/**
@@ -59,10 +59,14 @@ export function component(node, get_component, render_fn) {
5959

6060
if (defer) {
6161
offscreen_fragment = document.createDocumentFragment();
62-
offscreen_fragment.append((target = document.createComment('')));
62+
offscreen_fragment.append((target = create_text()));
6363
}
6464

6565
pending_effect = branch(() => render_fn(target, component));
66+
67+
if (defer) {
68+
target.remove();
69+
}
6670
}
6771

6872
if (defer) {

0 commit comments

Comments
 (0)