MCPcopy
hub / github.com/sveltejs/svelte / move

Function move

packages/svelte/src/internal/client/dom/blocks/each.js:705–726  ·  view source on GitHub ↗

* @param {Effect} effect * @param {Effect | null} next * @param {Text | Element | Comment} anchor

(effect, next, anchor)

Source from the content-addressed store, hash-verified

703 * @param {Text | Element | Comment} anchor
704 */
705function move(effect, next, anchor) {
706 if (!effect.nodes) return;
707
708 var node = effect.nodes.start;
709 var end = effect.nodes.end;
710
711 var dest =
712 next && (next.f & EFFECT_OFFSCREEN) === 0
713 ? /** @type {EffectNodes} */ (next.nodes).start
714 : anchor;
715
716 while (node !== null) {
717 var next_node = /** @type {TemplateNode} */ (get_next_sibling(node));
718 dest.before(node);
719
720 if (node === end) {
721 return;
722 }
723
724 node = next_node;
725 }
726}
727
728/**
729 * @param {EachState} state

Callers 2

commitFunction · 0.85
reconcileFunction · 0.85

Calls 1

get_next_siblingFunction · 0.90

Tested by

no test coverage detected