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

Function traverseEnterLeave

code/styling/public/app.js:2605–2643  ·  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

2603 * "entered" or "left" that element.
2604 */
2605function traverseEnterLeave(from, to, fn, argFrom, argTo) {
2606 var common = from && to ? getLowestCommonAncestor(from, to) : null;
2607 var pathFrom = [];
2608 while (true) {
2609 if (!from) {
2610 break;
2611 }
2612 if (from === common) {
2613 break;
2614 }
2615 var alternate = from.alternate;
2616 if (alternate !== null && alternate === common) {
2617 break;
2618 }
2619 pathFrom.push(from);
2620 from = getParent(from);
2621 }
2622 var pathTo = [];
2623 while (true) {
2624 if (!to) {
2625 break;
2626 }
2627 if (to === common) {
2628 break;
2629 }
2630 var _alternate = to.alternate;
2631 if (_alternate !== null && _alternate === common) {
2632 break;
2633 }
2634 pathTo.push(to);
2635 to = getParent(to);
2636 }
2637 for (var i = 0; i < pathFrom.length; i++) {
2638 fn(pathFrom[i], 'bubbled', argFrom);
2639 }
2640 for (var _i = pathTo.length; _i-- > 0;) {
2641 fn(pathTo[_i], 'captured', argTo);
2642 }
2643}
2644
2645/**
2646 * 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