From 1e19135d057ddcfe9da2b764baafeced57c064d9 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Tue, 9 Apr 2024 11:03:58 +0100 Subject: [PATCH] simplify --- .../internal/client/dom/blocks/svelte-head.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/svelte/src/internal/client/dom/blocks/svelte-head.js b/packages/svelte/src/internal/client/dom/blocks/svelte-head.js index 89d3bb631114..b00a3a242b1e 100644 --- a/packages/svelte/src/internal/client/dom/blocks/svelte-head.js +++ b/packages/svelte/src/internal/client/dom/blocks/svelte-head.js @@ -33,21 +33,10 @@ export function head(render_fn) { head_anchor = /** @type {import('#client').TemplateNode} */ (document.head.firstChild); } - var depth = 0; - - while (head_anchor !== null) { - if (head_anchor.nodeType === 8) { - var data = /** @type {Comment} */ (head_anchor).data; - if (data === HYDRATION_START) { - if (depth === 0) { - break; - } - depth++; - } - if (data === HYDRATION_END) { - depth--; - } - } + while ( + head_anchor.nodeType !== 8 || + /** @type {Comment} */ (head_anchor).data !== HYDRATION_START + ) { head_anchor = /** @type {import('#client').TemplateNode} */ (head_anchor.nextSibling); }