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

Function handleTopLevel

code/composition/public/app.js:5975–6000  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

5973}
5974
5975function handleTopLevel(bookKeeping) {
5976 var targetInst = bookKeeping.targetInst;
5977
5978 // Loop through the hierarchy, in case there's any nested components.
5979 // It's important that we build the array of ancestors before calling any
5980 // event handlers, because event handlers can modify the DOM, leading to
5981 // inconsistencies with ReactMount's node cache. See #1105.
5982 var ancestor = targetInst;
5983 do {
5984 if (!ancestor) {
5985 bookKeeping.ancestors.push(ancestor);
5986 break;
5987 }
5988 var root = findRootContainerNode(ancestor);
5989 if (!root) {
5990 break;
5991 }
5992 bookKeeping.ancestors.push(ancestor);
5993 ancestor = getClosestInstanceFromNode(root);
5994 } while (ancestor);
5995
5996 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
5997 targetInst = bookKeeping.ancestors[i];
5998 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
5999 }
6000}
6001
6002// TODO: can we stop exporting these?
6003var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected