|
|
|
@ -482,11 +482,10 @@ function create_item(anchor, prev, next, value, key, index, render_fn, flags) {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {import('#client').TemplateNode} dom
|
|
|
|
|
* @param {import('#client').TemplateNode | null} sibling
|
|
|
|
|
* @param {import("#client").Effect} effect
|
|
|
|
|
* @returns {import('#client').TemplateNode}
|
|
|
|
|
*/
|
|
|
|
|
function get_adjusted_first_node(dom, sibling, effect) {
|
|
|
|
|
function get_adjusted_first_node(dom, effect) {
|
|
|
|
|
if ((dom.nodeType === 3 && /** @type {Text} */ (dom).data === '') || dom.nodeType === 8) {
|
|
|
|
|
var adjusted = effect.first;
|
|
|
|
|
var next;
|
|
|
|
@ -499,11 +498,7 @@ function get_adjusted_first_node(dom, sibling, effect) {
|
|
|
|
|
}
|
|
|
|
|
adjusted = next;
|
|
|
|
|
}
|
|
|
|
|
var adjusted_dom = get_first_node(/** @type {import("#client").Effect} */ (adjusted));
|
|
|
|
|
// If we have a sibling that contains the adjusted_dom, then use that instead.
|
|
|
|
|
if (sibling?.contains(adjusted_dom)) {
|
|
|
|
|
return sibling;
|
|
|
|
|
}
|
|
|
|
|
return get_first_node(/** @type {import("#client").Effect} */ (adjusted));
|
|
|
|
|
}
|
|
|
|
|
return dom;
|
|
|
|
|
}
|
|
|
|
@ -516,13 +511,12 @@ function get_adjusted_first_node(dom, sibling, effect) {
|
|
|
|
|
function get_first_node(effect) {
|
|
|
|
|
var dom = effect.dom;
|
|
|
|
|
if (is_array(dom)) {
|
|
|
|
|
return get_adjusted_first_node(dom[0], dom[1], effect);
|
|
|
|
|
var adjusted_dom = get_adjusted_first_node(dom[0], effect);
|
|
|
|
|
// If we have a sibling that contains the adjusted_dom, then use that instead.
|
|
|
|
|
var sibling = dom[1];
|
|
|
|
|
return sibling?.contains(adjusted_dom) ? sibling : adjusted_dom;
|
|
|
|
|
}
|
|
|
|
|
return get_adjusted_first_node(
|
|
|
|
|
/** @type {import('#client').TemplateNode} **/ (dom),
|
|
|
|
|
null,
|
|
|
|
|
effect
|
|
|
|
|
);
|
|
|
|
|
return get_adjusted_first_node(/** @type {import('#client').TemplateNode} **/ (dom), effect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|