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

Function handleTopLevel

code/redux/public/app.js:6088–6113  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

6086}
6087
6088function handleTopLevel(bookKeeping) {
6089 var targetInst = bookKeeping.targetInst;
6090
6091 // Loop through the hierarchy, in case there's any nested components.
6092 // It's important that we build the array of ancestors before calling any
6093 // event handlers, because event handlers can modify the DOM, leading to
6094 // inconsistencies with ReactMount's node cache. See #1105.
6095 var ancestor = targetInst;
6096 do {
6097 if (!ancestor) {
6098 bookKeeping.ancestors.push(ancestor);
6099 break;
6100 }
6101 var root = findRootContainerNode(ancestor);
6102 if (!root) {
6103 break;
6104 }
6105 bookKeeping.ancestors.push(ancestor);
6106 ancestor = getClosestInstanceFromNode(root);
6107 } while (ancestor);
6108
6109 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
6110 targetInst = bookKeeping.ancestors[i];
6111 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
6112 }
6113}
6114
6115// TODO: can we stop exporting these?
6116var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected