(bookKeeping)
| 3638 | } |
| 3639 | |
| 3640 | function handleTopLevel(bookKeeping) { |
| 3641 | var targetInst = bookKeeping.targetInst; // Loop through the hierarchy, in case there's any nested components. |
| 3642 | // It's important that we build the array of ancestors before calling any |
| 3643 | // event handlers, because event handlers can modify the DOM, leading to |
| 3644 | // inconsistencies with ReactMount's node cache. See #1105. |
| 3645 | |
| 3646 | var ancestor = targetInst; |
| 3647 | |
| 3648 | do { |
| 3649 | if (!ancestor) { |
| 3650 | var ancestors = bookKeeping.ancestors; |
| 3651 | ancestors.push(ancestor); |
| 3652 | break; |
| 3653 | } |
| 3654 | |
| 3655 | var root = findRootContainerNode(ancestor); |
| 3656 | |
| 3657 | if (!root) { |
| 3658 | break; |
| 3659 | } |
| 3660 | |
| 3661 | var tag = ancestor.tag; |
| 3662 | |
| 3663 | if (tag === HostComponent || tag === HostText) { |
| 3664 | bookKeeping.ancestors.push(ancestor); |
| 3665 | } |
| 3666 | |
| 3667 | ancestor = getClosestInstanceFromNode(root); |
| 3668 | } while (ancestor); |
| 3669 | |
| 3670 | for (var i = 0; i < bookKeeping.ancestors.length; i++) { |
| 3671 | targetInst = bookKeeping.ancestors[i]; |
| 3672 | var eventTarget = getEventTarget(bookKeeping.nativeEvent); |
| 3673 | var topLevelType = bookKeeping.topLevelType; |
| 3674 | var nativeEvent = bookKeeping.nativeEvent; |
| 3675 | var eventSystemFlags = bookKeeping.eventSystemFlags; // If this is the first ancestor, we mark it on the system flags |
| 3676 | |
| 3677 | if (i === 0) { |
| 3678 | eventSystemFlags |= IS_FIRST_ANCESTOR; |
| 3679 | } |
| 3680 | |
| 3681 | runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, eventTarget, eventSystemFlags); |
| 3682 | } |
| 3683 | } |
| 3684 | |
| 3685 | function dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) { |
| 3686 | var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags); |
nothing calls this directly
no test coverage detected