pull/12335/head
Rich Harris 2 years ago
parent 4de3f2e234
commit 11a9ada14f

@ -15,7 +15,6 @@ import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
* @returns {void} * @returns {void}
*/ */
export function snippet(anchor, get_snippet, ...args) { export function snippet(anchor, get_snippet, ...args) {
// console.log('snippet start', { anchor });
if (hydrating) { if (hydrating) {
hydrate_next(); hydrate_next();
} }
@ -41,7 +40,6 @@ export function snippet(anchor, get_snippet, ...args) {
if (hydrating) { if (hydrating) {
anchor = hydrate_node; anchor = hydrate_node;
// console.log('snippet end', { anchor });
} }
} }

@ -86,7 +86,6 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
pause_effect(effect, () => { pause_effect(effect, () => {
effect = null; effect = null;
current_tag = null; current_tag = null;
// element?.remove();
}); });
} else if (next_tag === current_tag) { } else if (next_tag === current_tag) {
// same tag as is currently rendered — abort outro // same tag as is currently rendered — abort outro

@ -3,7 +3,6 @@ import { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
import { init_array_prototype_warnings } from '../dev/equality.js'; import { init_array_prototype_warnings } from '../dev/equality.js';
import { current_effect } from '../runtime.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 // export these for reference in the compiled code, making global name deduplication unnecessary
/** @type {Window} */ /** @type {Window} */
@ -96,8 +95,6 @@ export function first_child(fragment, is_text) {
return first; return first;
} }
// hydrate_next();
// if an {expression} is empty during SSR, there might be no // if an {expression} is empty during SSR, there might be no
// text node to hydrate — we must therefore create one // text node to hydrate — we must therefore create one
if (is_text && hydrate_node?.nodeType !== 3) { if (is_text && hydrate_node?.nodeType !== 3) {
@ -113,11 +110,6 @@ export function first_child(fragment, is_text) {
return text; return text;
} }
// console.log('first_child', {
// hydrate_node,
// content: hydrate_node.data ?? hydrate_node.outerHTML
// });
return hydrate_node; return hydrate_node;
} }
@ -137,10 +129,6 @@ export function sibling(node, is_text = false) {
var type = next_sibling.nodeType; 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 // if a sibling {expression} is empty during SSR, there might be no
// text node to hydrate — we must therefore create one // text node to hydrate — we must therefore create one
if (is_text && type !== 3) { if (is_text && type !== 3) {

@ -194,6 +194,7 @@ function run_scripts(node) {
} }
clone.textContent = script.textContent; clone.textContent = script.textContent;
// If node === script tag, replaceWith will do nothing because there's no parent yet, // 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. // waiting until that's the case using an effect solves this.
// Don't do it in other circumstances or we could accidentally execute scripts // 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; var node = hydrate_node;
// console.log('text', { hydrate_node });
if (node.nodeType !== 3) { if (node.nodeType !== 3) {
// if an {expression} is empty during SSR, we need to insert an empty text node // if an {expression} is empty during SSR, we need to insert an empty text node
node.before((node = empty())); node.before((node = empty()));
set_hydrate_node(node); set_hydrate_node(node);
} }
// if (anchored) {
// hydrate_next();
// }
assign_nodes(node, node); assign_nodes(node, node);
return node; return node;
} }
@ -267,18 +262,6 @@ export function append(anchor, dom) {
if (hydrating) { if (hydrating) {
/** @type {Effect & { nodes: EffectNodes }} */ (current_effect).nodes.end = hydrate_node; /** @type {Effect & { nodes: EffectNodes }} */ (current_effect).nodes.end = hydrate_node;
hydrate_next(); 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; return;
} }

Loading…
Cancel
Save