* Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent}
(nativeEvent, nativeEventTarget)
| 5881 | * @return {?SyntheticEvent} |
| 5882 | */ |
| 5883 | function constructSelectEvent(nativeEvent, nativeEventTarget) { |
| 5884 | // Ensure we have the right element, and that the user is not dragging a |
| 5885 | // selection (this matches native `select` event behavior). In HTML5, select |
| 5886 | // fires only on input and textarea thus if there's no focused element we |
| 5887 | // won't dispatch. |
| 5888 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { |
| 5889 | return null; |
| 5890 | } |
| 5891 | |
| 5892 | // Only fire when selection has actually changed. |
| 5893 | var currentSelection = getSelection(activeElement$1); |
| 5894 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
| 5895 | lastSelection = currentSelection; |
| 5896 | |
| 5897 | var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); |
| 5898 | |
| 5899 | syntheticEvent.type = 'select'; |
| 5900 | syntheticEvent.target = activeElement$1; |
| 5901 | |
| 5902 | accumulateTwoPhaseDispatches(syntheticEvent); |
| 5903 | |
| 5904 | return syntheticEvent; |
| 5905 | } |
| 5906 | |
| 5907 | return null; |
| 5908 | } |
| 5909 | |
| 5910 | /** |
| 5911 | * This plugin creates an `onSelect` event that normalizes select events |
no test coverage detected