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

Function traverseEnterLeave

code/redux/public/app.js:2856–2894  ·  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

2854 * "entered" or "left" that element.
2855 */
2856function traverseEnterLeave(from, to, fn, argFrom, argTo) {
2857 var common = from && to ? getLowestCommonAncestor(from, to) : null;
2858 var pathFrom = [];
2859 while (true) {
2860 if (!from) {
2861 break;
2862 }
2863 if (from === common) {
2864 break;
2865 }
2866 var alternate = from.alternate;
2867 if (alternate !== null && alternate === common) {
2868 break;
2869 }
2870 pathFrom.push(from);
2871 from = getParent(from);
2872 }
2873 var pathTo = [];
2874 while (true) {
2875 if (!to) {
2876 break;
2877 }
2878 if (to === common) {
2879 break;
2880 }
2881 var _alternate = to.alternate;
2882 if (_alternate !== null && _alternate === common) {
2883 break;
2884 }
2885 pathTo.push(to);
2886 to = getParent(to);
2887 }
2888 for (var i = 0; i < pathFrom.length; i++) {
2889 fn(pathFrom[i], 'bubbled', argFrom);
2890 }
2891 for (var _i = pathTo.length; _i-- > 0;) {
2892 fn(pathTo[_i], 'captured', argTo);
2893 }
2894}
2895
2896/**
2897 * 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