MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / removeNodeRange

Function removeNodeRange

06.Router/basic/js/vue.js:1501–1519  ·  view source on GitHub ↗

* Remove a range of nodes with transition, store * the nodes in a fragment with correct ordering, * and call callback when done. * * @param {Node} start * @param {Node} end * @param {Vue} vm * @param {DocumentFragment} frag * @param {Function} cb

(start, end, vm, frag, cb)

Source from the content-addressed store, hash-verified

1499 */
1500
1501 function removeNodeRange(start, end, vm, frag, cb) {
1502 var done = false;
1503 var removed = 0;
1504 var nodes = [];
1505 mapNodeRange(start, end, function (node) {
1506 if (node === end) done = true;
1507 nodes.push(node);
1508 removeWithTransition(node, vm, onRemoved);
1509 });
1510 function onRemoved() {
1511 removed++;
1512 if (done && removed >= nodes.length) {
1513 for (var i = 0; i < nodes.length; i++) {
1514 frag.appendChild(nodes[i]);
1515 }
1516 cb && cb();
1517 }
1518 }
1519 }
1520
1521 /**
1522 * Check if a node is a DocumentFragment.

Callers 2

multiRemoveFunction · 0.70
domAPIFunction · 0.70

Calls 2

mapNodeRangeFunction · 0.70
removeWithTransitionFunction · 0.70

Tested by

no test coverage detected