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

Function handleTopLevel

code/dependency-injection/public/app.js:5930–5955  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

5928}
5929
5930function handleTopLevel(bookKeeping) {
5931 var targetInst = bookKeeping.targetInst;
5932
5933 // Loop through the hierarchy, in case there's any nested components.
5934 // It's important that we build the array of ancestors before calling any
5935 // event handlers, because event handlers can modify the DOM, leading to
5936 // inconsistencies with ReactMount's node cache. See #1105.
5937 var ancestor = targetInst;
5938 do {
5939 if (!ancestor) {
5940 bookKeeping.ancestors.push(ancestor);
5941 break;
5942 }
5943 var root = findRootContainerNode(ancestor);
5944 if (!root) {
5945 break;
5946 }
5947 bookKeeping.ancestors.push(ancestor);
5948 ancestor = getClosestInstanceFromNode(root);
5949 } while (ancestor);
5950
5951 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
5952 targetInst = bookKeeping.ancestors[i];
5953 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
5954 }
5955}
5956
5957// TODO: can we stop exporting these?
5958var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected