pull/10891/head
Rich Harris 2 years ago
parent 500490cc7e
commit 58dad20f38

@ -48,8 +48,7 @@ function get_hydrate_nodes(node, insert_text = false) {
/** @type {import('#client').TemplateNode[]} */
var nodes = [];
/** @type {null | Node} */
var current_node = node;
var current_node = /** @type {null | import('#client').TemplateNode} */ (node);
/** @type {null | string} */
var target_depth = null;
@ -67,18 +66,18 @@ function get_hydrate_nodes(node, insert_text = false) {
if (insert_text && nodes.length === 0) {
var text = empty();
nodes.push(text);
text.before(current_node);
current_node.before(text);
}
return nodes;
} else {
nodes.push(/** @type {Text | Comment | Element} */ (current_node));
nodes.push(current_node);
}
}
} else if (target_depth !== null) {
nodes.push(/** @type {Text | Comment | Element} */ (current_node));
nodes.push(current_node);
}
current_node = current_node.nextSibling;
current_node = /** @type {null | import('#client').TemplateNode} */ (current_node.nextSibling);
}
return null;

@ -114,7 +114,6 @@ export function createRoot() {
* @returns {Exports}
*/
export function mount(component, options) {
init_operations();
const anchor = empty();
options.target.appendChild(anchor);
// Don't flush previous effects to ensure order of outer effects stays consistent
@ -139,8 +138,6 @@ export function mount(component, options) {
* @returns {Exports}
*/
export function hydrate(component, options) {
init_operations();
const container = options.target;
const first_child = /** @type {ChildNode} */ (container.firstChild);
const previous_hydrate_nodes = hydrate_nodes;
@ -212,6 +209,8 @@ export function hydrate(component, options) {
* @returns {Exports}
*/
function _mount(Component, options) {
init_operations();
const registered_events = new Set();
const container = options.target;

Loading…
Cancel
Save