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

Function traverseTwoPhase

docs/external/js/react-dom.development.js:8148–8165  ·  view source on GitHub ↗

* Simulates the traversal of a two-phase, capture/bubble event dispatch.

(inst, fn, arg)

Source from the content-addressed store, hash-verified

8146 */
8147
8148 function traverseTwoPhase(inst, fn, arg) {
8149 var path = [];
8150
8151 while (inst) {
8152 path.push(inst);
8153 inst = getParent(inst);
8154 }
8155
8156 var i;
8157
8158 for (i = path.length; i-- > 0;) {
8159 fn(path[i], 'captured', arg);
8160 }
8161
8162 for (i = 0; i < path.length; i++) {
8163 fn(path[i], 'bubbled', arg);
8164 }
8165 }
8166 /**
8167 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
8168 * should would receive a `mouseEnter` or `mouseLeave` event.

Callers 1

Calls 2

getParentFunction · 0.70
fnFunction · 0.50

Tested by

no test coverage detected