MCPcopy Index your code
hub / github.com/SortableJS/Sortable / swapNodes

Function swapNodes

modular/sortable.core.esm.js:2756–2769  ·  view source on GitHub ↗
(n1, n2)

Source from the content-addressed store, hash-verified

2754 });
2755}
2756function swapNodes(n1, n2) {
2757 var p1 = n1.parentNode,
2758 p2 = n2.parentNode,
2759 i1,
2760 i2;
2761 if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;
2762 i1 = index(n1);
2763 i2 = index(n2);
2764 if (p1.isEqualNode(p2) && i1 < i2) {
2765 i2++;
2766 }
2767 p1.insertBefore(n2, p1.children[i1]);
2768 p2.insertBefore(n1, p2.children[i2]);
2769}
2770
2771var multiDragElements = [],
2772 multiDragClones = [],

Callers 1

SwapPluginFunction · 0.70

Calls 1

indexFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…