MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / handleTopLevel

Function handleTopLevel

code/new-context-api/public/app.js:5198–5223  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

5196}
5197
5198function handleTopLevel(bookKeeping) {
5199 var targetInst = bookKeeping.targetInst;
5200
5201 // Loop through the hierarchy, in case there's any nested components.
5202 // It's important that we build the array of ancestors before calling any
5203 // event handlers, because event handlers can modify the DOM, leading to
5204 // inconsistencies with ReactMount's node cache. See #1105.
5205 var ancestor = targetInst;
5206 do {
5207 if (!ancestor) {
5208 bookKeeping.ancestors.push(ancestor);
5209 break;
5210 }
5211 var root = findRootContainerNode(ancestor);
5212 if (!root) {
5213 break;
5214 }
5215 bookKeeping.ancestors.push(ancestor);
5216 ancestor = getClosestInstanceFromNode(root);
5217 } while (ancestor);
5218
5219 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
5220 targetInst = bookKeeping.ancestors[i];
5221 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
5222 }
5223}
5224
5225// TODO: can we stop exporting these?
5226var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected