* Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent}
(nativeEvent, nativeEventTarget)
| 6648 | * @return {?SyntheticEvent} |
| 6649 | */ |
| 6650 | function constructSelectEvent(nativeEvent, nativeEventTarget) { |
| 6651 | // Ensure we have the right element, and that the user is not dragging a |
| 6652 | // selection (this matches native `select` event behavior). In HTML5, select |
| 6653 | // fires only on input and textarea thus if there's no focused element we |
| 6654 | // won't dispatch. |
| 6655 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { |
| 6656 | return null; |
| 6657 | } |
| 6658 | |
| 6659 | // Only fire when selection has actually changed. |
| 6660 | var currentSelection = getSelection(activeElement$1); |
| 6661 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
| 6662 | lastSelection = currentSelection; |
| 6663 | |
| 6664 | var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); |
| 6665 | |
| 6666 | syntheticEvent.type = 'select'; |
| 6667 | syntheticEvent.target = activeElement$1; |
| 6668 | |
| 6669 | accumulateTwoPhaseDispatches(syntheticEvent); |
| 6670 | |
| 6671 | return syntheticEvent; |
| 6672 | } |
| 6673 | |
| 6674 | return null; |
| 6675 | } |
| 6676 | |
| 6677 | /** |
| 6678 | * This plugin creates an `onSelect` event that normalizes select events |
no test coverage detected