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

Function traverseEnterLeave

code/third-party/public/app.js:1838–1876  ·  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

1836 * "entered" or "left" that element.
1837 */
1838function traverseEnterLeave(from, to, fn, argFrom, argTo) {
1839 var common = from && to ? getLowestCommonAncestor(from, to) : null;
1840 var pathFrom = [];
1841 while (true) {
1842 if (!from) {
1843 break;
1844 }
1845 if (from === common) {
1846 break;
1847 }
1848 var alternate = from.alternate;
1849 if (alternate !== null && alternate === common) {
1850 break;
1851 }
1852 pathFrom.push(from);
1853 from = getParent(from);
1854 }
1855 var pathTo = [];
1856 while (true) {
1857 if (!to) {
1858 break;
1859 }
1860 if (to === common) {
1861 break;
1862 }
1863 var _alternate = to.alternate;
1864 if (_alternate !== null && _alternate === common) {
1865 break;
1866 }
1867 pathTo.push(to);
1868 to = getParent(to);
1869 }
1870 for (var i = 0; i < pathFrom.length; i++) {
1871 fn(pathFrom[i], 'bubbled', argFrom);
1872 }
1873 for (var _i = pathTo.length; _i-- > 0;) {
1874 fn(pathTo[_i], 'captured', argTo);
1875 }
1876}
1877
1878/**
1879 * 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