* Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent}
(nativeEvent, nativeEventTarget)
| 6683 | * @return {?SyntheticEvent} |
| 6684 | */ |
| 6685 | function constructSelectEvent(nativeEvent, nativeEventTarget) { |
| 6686 | // Ensure we have the right element, and that the user is not dragging a |
| 6687 | // selection (this matches native `select` event behavior). In HTML5, select |
| 6688 | // fires only on input and textarea thus if there's no focused element we |
| 6689 | // won't dispatch. |
| 6690 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { |
| 6691 | return null; |
| 6692 | } |
| 6693 | |
| 6694 | // Only fire when selection has actually changed. |
| 6695 | var currentSelection = getSelection(activeElement$1); |
| 6696 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
| 6697 | lastSelection = currentSelection; |
| 6698 | |
| 6699 | var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); |
| 6700 | |
| 6701 | syntheticEvent.type = 'select'; |
| 6702 | syntheticEvent.target = activeElement$1; |
| 6703 | |
| 6704 | accumulateTwoPhaseDispatches(syntheticEvent); |
| 6705 | |
| 6706 | return syntheticEvent; |
| 6707 | } |
| 6708 | |
| 6709 | return null; |
| 6710 | } |
| 6711 | |
| 6712 | /** |
| 6713 | * This plugin creates an `onSelect` event that normalizes select events |
no test coverage detected