pull/12335/head
Rich Harris 2 years ago
parent 9607f7e17e
commit bf75fd81fa

@ -1680,8 +1680,7 @@ export const template_visitors = {
process_children(trimmed, () => b.id('$$anchor'), false, { ...context, state });
} else {
/** @type {(is_text: boolean) => import('estree').Expression} */
const expression = (is_text) =>
is_text ? b.call('$.first_child', id, b.true) : b.call('$.first_child', id);
const expression = (is_text) => b.call('$.first_child', id, is_text && b.true);
process_children(trimmed, expression, false, { ...context, state });
@ -2184,6 +2183,9 @@ export const template_visitors = {
{ ...context, state: child_state }
);
// TODO only do this when necessary, and use a function with `if (hydrating)` so that it noops for non-hydraters
child_state.init.push(b.stmt(b.call('$.set_hydrate_node', context.state.node)));
if (has_declaration) {
context.state.init.push(
b.block([

@ -70,6 +70,7 @@ export function child(node) {
return hydrate_node.appendChild(empty());
}
set_hydrate_node(child);
return child;
}

@ -62,6 +62,7 @@ export {
bind_focused
} from './dom/elements/bindings/universal.js';
export { bind_window_scroll, bind_window_size } from './dom/elements/bindings/window.js';
export { set_hydrate_node } from './dom/hydration.js';
export {
once,
preventDefault,

Loading…
Cancel
Save