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

Function handleTopLevel

code/styling/public/app.js:5837–5862  ·  view source on GitHub ↗
(bookKeeping)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

findRootContainerNodeFunction · 0.70
getEventTargetFunction · 0.70

Tested by

no test coverage detected