diff --git a/packages/svelte/src/internal/client/dom/blocks/snippet.js b/packages/svelte/src/internal/client/dom/blocks/snippet.js index 46470fcff9..6295c30ba5 100644 --- a/packages/svelte/src/internal/client/dom/blocks/snippet.js +++ b/packages/svelte/src/internal/client/dom/blocks/snippet.js @@ -15,7 +15,6 @@ import { hydrate_next, hydrate_node, hydrating } from '../hydration.js'; * @returns {void} */ export function snippet(anchor, get_snippet, ...args) { - // console.log('snippet start', { anchor }); if (hydrating) { hydrate_next(); } @@ -41,7 +40,6 @@ export function snippet(anchor, get_snippet, ...args) { if (hydrating) { anchor = hydrate_node; - // console.log('snippet end', { anchor }); } } diff --git a/packages/svelte/src/internal/client/dom/blocks/svelte-element.js b/packages/svelte/src/internal/client/dom/blocks/svelte-element.js index ba982a7a59..ff72a2f92c 100644 --- a/packages/svelte/src/internal/client/dom/blocks/svelte-element.js +++ b/packages/svelte/src/internal/client/dom/blocks/svelte-element.js @@ -86,7 +86,6 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio pause_effect(effect, () => { effect = null; current_tag = null; - // element?.remove(); }); } else if (next_tag === current_tag) { // same tag as is currently rendered — abort outro diff --git a/packages/svelte/src/internal/client/dom/operations.js b/packages/svelte/src/internal/client/dom/operations.js index 4429534fe8..9f3b1999e5 100644 --- a/packages/svelte/src/internal/client/dom/operations.js +++ b/packages/svelte/src/internal/client/dom/operations.js @@ -3,7 +3,6 @@ import { hydrate_node, hydrating, set_hydrate_node } from './hydration.js'; import { DEV } from 'esm-env'; import { init_array_prototype_warnings } from '../dev/equality.js'; import { current_effect } from '../runtime.js'; -import { HYDRATION_ANCHOR } from '../../../constants.js'; // export these for reference in the compiled code, making global name deduplication unnecessary /** @type {Window} */ @@ -96,8 +95,6 @@ export function first_child(fragment, is_text) { return first; } - // hydrate_next(); - // if an {expression} is empty during SSR, there might be no // text node to hydrate — we must therefore create one if (is_text && hydrate_node?.nodeType !== 3) { @@ -113,11 +110,6 @@ export function first_child(fragment, is_text) { return text; } - // console.log('first_child', { - // hydrate_node, - // content: hydrate_node.data ?? hydrate_node.outerHTML - // }); - return hydrate_node; } @@ -137,10 +129,6 @@ export function sibling(node, is_text = false) { var type = next_sibling.nodeType; - // if (type === 8 && /** @type {Comment} */ (next_sibling).data === HYDRATION_ANCHOR) { - // return sibling(next_sibling, is_text); - // } - // if a sibling {expression} is empty during SSR, there might be no // text node to hydrate — we must therefore create one if (is_text && type !== 3) { diff --git a/packages/svelte/src/internal/client/dom/template.js b/packages/svelte/src/internal/client/dom/template.js index 63d72af191..fd247e0654 100644 --- a/packages/svelte/src/internal/client/dom/template.js +++ b/packages/svelte/src/internal/client/dom/template.js @@ -194,6 +194,7 @@ function run_scripts(node) { } clone.textContent = script.textContent; + // If node === script tag, replaceWith will do nothing because there's no parent yet, // waiting until that's the case using an effect solves this. // Don't do it in other circumstances or we could accidentally execute scripts @@ -224,18 +225,12 @@ export function text(anchored) { var node = hydrate_node; - // console.log('text', { hydrate_node }); - if (node.nodeType !== 3) { // if an {expression} is empty during SSR, we need to insert an empty text node node.before((node = empty())); set_hydrate_node(node); } - // if (anchored) { - // hydrate_next(); - // } - assign_nodes(node, node); return node; } @@ -267,18 +262,6 @@ export function append(anchor, dom) { if (hydrating) { /** @type {Effect & { nodes: EffectNodes }} */ (current_effect).nodes.end = hydrate_node; hydrate_next(); - - // console.log('effect.nodes', current_effect.nodes); - // console.log(dom); - - // // next node should be a - // var next = hydrate_node.nextSibling; - // if (next === null || next.nodeType !== 8) { - // throw new Error('TODO'); - // } - - // set_hydrate_node(/** @type {Comment} */ (next)); - return; }