MCPcopy Create free account
hub / github.com/microsoft/SandDance / traverseEnterLeave

Function traverseEnterLeave

docs/external/js/react-dom.development.js:8174–8225  ·  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

8172 */
8173
8174 function traverseEnterLeave(from, to, fn, argFrom, argTo) {
8175 var common = from && to ? getLowestCommonAncestor(from, to) : null;
8176 var pathFrom = [];
8177
8178 while (true) {
8179 if (!from) {
8180 break;
8181 }
8182
8183 if (from === common) {
8184 break;
8185 }
8186
8187 var alternate = from.alternate;
8188
8189 if (alternate !== null && alternate === common) {
8190 break;
8191 }
8192
8193 pathFrom.push(from);
8194 from = getParent(from);
8195 }
8196
8197 var pathTo = [];
8198
8199 while (true) {
8200 if (!to) {
8201 break;
8202 }
8203
8204 if (to === common) {
8205 break;
8206 }
8207
8208 var _alternate = to.alternate;
8209
8210 if (_alternate !== null && _alternate === common) {
8211 break;
8212 }
8213
8214 pathTo.push(to);
8215 to = getParent(to);
8216 }
8217
8218 for (var i = 0; i < pathFrom.length; i++) {
8219 fn(pathFrom[i], 'bubbled', argFrom);
8220 }
8221
8222 for (var _i = pathTo.length; _i-- > 0;) {
8223 fn(pathTo[_i], 'captured', argTo);
8224 }
8225 }
8226
8227 function isInteractive(tag) {
8228 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';

Callers 1

Calls 3

getLowestCommonAncestorFunction · 0.85
getParentFunction · 0.70
fnFunction · 0.50

Tested by

no test coverage detected