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

Function handleTopLevel

code/higher-order-components/public/app.js:5831–5856  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

5829}
5830
5831function handleTopLevel(bookKeeping) {
5832 var targetInst = bookKeeping.targetInst;
5833
5834 // Loop through the hierarchy, in case there's any nested components.
5835 // It's important that we build the array of ancestors before calling any
5836 // event handlers, because event handlers can modify the DOM, leading to
5837 // inconsistencies with ReactMount's node cache. See #1105.
5838 var ancestor = targetInst;
5839 do {
5840 if (!ancestor) {
5841 bookKeeping.ancestors.push(ancestor);
5842 break;
5843 }
5844 var root = findRootContainerNode(ancestor);
5845 if (!root) {
5846 break;
5847 }
5848 bookKeeping.ancestors.push(ancestor);
5849 ancestor = getClosestInstanceFromNode(root);
5850 } while (ancestor);
5851
5852 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
5853 targetInst = bookKeeping.ancestors[i];
5854 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
5855 }
5856}
5857
5858// TODO: can we stop exporting these?
5859var _enabled = true;

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected