Skip to content

Commit ea45a99

Browse files
committed
simplify
1 parent a1c063b commit ea45a99

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/svelte/src/internal/client/dom/operations.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,14 @@ export function child(node) {
145145
/*#__NO_SIDE_EFFECTS__*/
146146
export function child_frag(node, is_text) {
147147
if (hydrating) {
148-
const first_node = /** @type {Node[]} */ (node)[0];
148+
const first_node = /** @type {import('#client').TemplateNode[]} */ (node)[0];
149149

150150
// if an {expression} is empty during SSR, there might be no
151151
// text node to hydrate — we must therefore create one
152152
if (is_text && first_node?.nodeType !== 3) {
153153
const text = empty();
154154
hydrate_nodes.unshift(text);
155-
if (first_node) {
156-
/** @type {DocumentFragment} */ (first_node.parentNode).insertBefore(text, first_node);
157-
}
155+
first_node?.before(text);
158156
return text;
159157
}
160158

0 commit comments

Comments
 (0)