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

Function handleTopLevel

code/communication/public/app.js:5872–5897  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

5870}
5871
5872function handleTopLevel(bookKeeping) {
5873 var targetInst = bookKeeping.targetInst;
5874
5875 // Loop through the hierarchy, in case there's any nested components.
5876 // It's important that we build the array of ancestors before calling any
5877 // event handlers, because event handlers can modify the DOM, leading to
5878 // inconsistencies with ReactMount's node cache. See #1105.
5879 var ancestor = targetInst;
5880 do {
5881 if (!ancestor) {
5882 bookKeeping.ancestors.push(ancestor);
5883 break;
5884 }
5885 var root = findRootContainerNode(ancestor);
5886 if (!root) {
5887 break;
5888 }
5889 bookKeeping.ancestors.push(ancestor);
5890 ancestor = getClosestInstanceFromNode(root);
5891 } while (ancestor);
5892
5893 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
5894 targetInst = bookKeeping.ancestors[i];
5895 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
5896 }
5897}
5898
5899// TODO: can we stop exporting these?
5900var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected