pull/11690/head
Rich Harris 2 years ago
parent b96e16d1c5
commit 54ac2b41b6

@ -95,3 +95,28 @@ export function hydrate_anchor(node) {
w.hydration_mismatch(location);
throw HYDRATION_ERROR;
}
export function remove_hydrate_nodes() {
let node = hydrate_start;
while (node) {
const next = node.nextSibling;
node.remove();
if (node === hydrate_end) break;
node = /** @type {import('#client').TemplateNode} */ (next);
}
}
/** @deprecated */
export function hydrate_nodes_to_array() {
// TODO get rid of this, just have start/end on effects
let node = hydrate_start;
const nodes = [node];
while (node.nextSibling) {
nodes.push((node = /** @type {import('#client').TemplateNode} */ (node.nextSibling)));
if (node === hydrate_end) break;
}
return nodes;
}

@ -1,4 +1,4 @@
import { hydrate_nodes, hydrate_start, hydrating } from './hydration.js';
import { hydrate_nodes, hydrate_nodes_to_array, hydrate_start, hydrating } from './hydration.js';
import { clone_node, empty } from './operations.js';
import { create_fragment_from_html } from './reconciler.js';
import { current_effect } from '../runtime.js';
@ -6,6 +6,19 @@ import { TEMPLATE_FRAGMENT, TEMPLATE_USE_IMPORT_NODE } from '../../../constants.
import { effect } from '../reactivity/effects.js';
import { is_array } from '../utils.js';
/**
* @deprecated
* @param {boolean} is_fragment
*/
function get_hydrate_nodes(is_fragment) {
// TODO get rid of this, just have start/end on effects
if (is_fragment) {
return hydrate_nodes_to_array();
}
return hydrate_start;
}
/**
* @template {import("#client").TemplateNode | import("#client").TemplateNode[]} T
* @param {T} dom

Loading…
Cancel
Save