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

Function traverseEnterLeave

code/composition/public/app.js:2743–2781  ·  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

2741 * "entered" or "left" that element.
2742 */
2743function traverseEnterLeave(from, to, fn, argFrom, argTo) {
2744 var common = from && to ? getLowestCommonAncestor(from, to) : null;
2745 var pathFrom = [];
2746 while (true) {
2747 if (!from) {
2748 break;
2749 }
2750 if (from === common) {
2751 break;
2752 }
2753 var alternate = from.alternate;
2754 if (alternate !== null && alternate === common) {
2755 break;
2756 }
2757 pathFrom.push(from);
2758 from = getParent(from);
2759 }
2760 var pathTo = [];
2761 while (true) {
2762 if (!to) {
2763 break;
2764 }
2765 if (to === common) {
2766 break;
2767 }
2768 var _alternate = to.alternate;
2769 if (_alternate !== null && _alternate === common) {
2770 break;
2771 }
2772 pathTo.push(to);
2773 to = getParent(to);
2774 }
2775 for (var i = 0; i < pathFrom.length; i++) {
2776 fn(pathFrom[i], 'bubbled', argFrom);
2777 }
2778 for (var _i = pathTo.length; _i-- > 0;) {
2779 fn(pathTo[_i], 'captured', argTo);
2780 }
2781}
2782
2783/**
2784 * 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