* Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent}
(nativeEvent, nativeEventTarget)
| 6899 | * @return {?SyntheticEvent} |
| 6900 | */ |
| 6901 | function constructSelectEvent(nativeEvent, nativeEventTarget) { |
| 6902 | // Ensure we have the right element, and that the user is not dragging a |
| 6903 | // selection (this matches native `select` event behavior). In HTML5, select |
| 6904 | // fires only on input and textarea thus if there's no focused element we |
| 6905 | // won't dispatch. |
| 6906 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { |
| 6907 | return null; |
| 6908 | } |
| 6909 | |
| 6910 | // Only fire when selection has actually changed. |
| 6911 | var currentSelection = getSelection(activeElement$1); |
| 6912 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
| 6913 | lastSelection = currentSelection; |
| 6914 | |
| 6915 | var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); |
| 6916 | |
| 6917 | syntheticEvent.type = 'select'; |
| 6918 | syntheticEvent.target = activeElement$1; |
| 6919 | |
| 6920 | accumulateTwoPhaseDispatches(syntheticEvent); |
| 6921 | |
| 6922 | return syntheticEvent; |
| 6923 | } |
| 6924 | |
| 6925 | return null; |
| 6926 | } |
| 6927 | |
| 6928 | /** |
| 6929 | * This plugin creates an `onSelect` event that normalizes select events |
no test coverage detected