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

Function handleTopLevel

code/third-party/public/app.js:5070–5095  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

5068}
5069
5070function handleTopLevel(bookKeeping) {
5071 var targetInst = bookKeeping.targetInst;
5072
5073 // Loop through the hierarchy, in case there's any nested components.
5074 // It's important that we build the array of ancestors before calling any
5075 // event handlers, because event handlers can modify the DOM, leading to
5076 // inconsistencies with ReactMount's node cache. See #1105.
5077 var ancestor = targetInst;
5078 do {
5079 if (!ancestor) {
5080 bookKeeping.ancestors.push(ancestor);
5081 break;
5082 }
5083 var root = findRootContainerNode(ancestor);
5084 if (!root) {
5085 break;
5086 }
5087 bookKeeping.ancestors.push(ancestor);
5088 ancestor = getClosestInstanceFromNode(root);
5089 } while (ancestor);
5090
5091 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
5092 targetInst = bookKeeping.ancestors[i];
5093 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
5094 }
5095}
5096
5097// TODO: can we stop exporting these?
5098var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected