* Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent}
(nativeEvent, nativeEventTarget)
| 5978 | * @return {?SyntheticEvent} |
| 5979 | */ |
| 5980 | function constructSelectEvent(nativeEvent, nativeEventTarget) { |
| 5981 | // Ensure we have the right element, and that the user is not dragging a |
| 5982 | // selection (this matches native `select` event behavior). In HTML5, select |
| 5983 | // fires only on input and textarea thus if there's no focused element we |
| 5984 | // won't dispatch. |
| 5985 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { |
| 5986 | return null; |
| 5987 | } |
| 5988 | |
| 5989 | // Only fire when selection has actually changed. |
| 5990 | var currentSelection = getSelection(activeElement$1); |
| 5991 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
| 5992 | lastSelection = currentSelection; |
| 5993 | |
| 5994 | var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); |
| 5995 | |
| 5996 | syntheticEvent.type = 'select'; |
| 5997 | syntheticEvent.target = activeElement$1; |
| 5998 | |
| 5999 | accumulateTwoPhaseDispatches(syntheticEvent); |
| 6000 | |
| 6001 | return syntheticEvent; |
| 6002 | } |
| 6003 | |
| 6004 | return null; |
| 6005 | } |
| 6006 | |
| 6007 | /** |
| 6008 | * This plugin creates an `onSelect` event that normalizes select events |
no test coverage detected