MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / traverseEnterLeave

Function traverseEnterLeave

code/dependency-injection/public/app.js:2698–2736  ·  view source on GitHub ↗

* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that * should would receive a `mouseEnter` or `mouseLeave` event. * * Does not invoke the callback on the nearest common ancestor because nothing * "entered" or "left" that element.

(from, to, fn, argFrom, argTo)

Source from the content-addressed store, hash-verified

2696 * "entered" or "left" that element.
2697 */
2698function traverseEnterLeave(from, to, fn, argFrom, argTo) {
2699 var common = from && to ? getLowestCommonAncestor(from, to) : null;
2700 var pathFrom = [];
2701 while (true) {
2702 if (!from) {
2703 break;
2704 }
2705 if (from === common) {
2706 break;
2707 }
2708 var alternate = from.alternate;
2709 if (alternate !== null && alternate === common) {
2710 break;
2711 }
2712 pathFrom.push(from);
2713 from = getParent(from);
2714 }
2715 var pathTo = [];
2716 while (true) {
2717 if (!to) {
2718 break;
2719 }
2720 if (to === common) {
2721 break;
2722 }
2723 var _alternate = to.alternate;
2724 if (_alternate !== null && _alternate === common) {
2725 break;
2726 }
2727 pathTo.push(to);
2728 to = getParent(to);
2729 }
2730 for (var i = 0; i < pathFrom.length; i++) {
2731 fn(pathFrom[i], 'bubbled', argFrom);
2732 }
2733 for (var _i = pathTo.length; _i-- > 0;) {
2734 fn(pathTo[_i], 'captured', argTo);
2735 }
2736}
2737
2738/**
2739 * Some event types have a notion of different registration names for different

Callers 1

Calls 2

getLowestCommonAncestorFunction · 0.70
getParentFunction · 0.70

Tested by

no test coverage detected