* Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent}
(nativeEvent, nativeEventTarget)
| 6009 | * @return {?SyntheticEvent} |
| 6010 | */ |
| 6011 | function constructSelectEvent(nativeEvent, nativeEventTarget) { |
| 6012 | // Ensure we have the right element, and that the user is not dragging a |
| 6013 | // selection (this matches native `select` event behavior). In HTML5, select |
| 6014 | // fires only on input and textarea thus if there's no focused element we |
| 6015 | // won't dispatch. |
| 6016 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { |
| 6017 | return null; |
| 6018 | } |
| 6019 | |
| 6020 | // Only fire when selection has actually changed. |
| 6021 | var currentSelection = getSelection(activeElement$1); |
| 6022 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
| 6023 | lastSelection = currentSelection; |
| 6024 | |
| 6025 | var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); |
| 6026 | |
| 6027 | syntheticEvent.type = 'select'; |
| 6028 | syntheticEvent.target = activeElement$1; |
| 6029 | |
| 6030 | accumulateTwoPhaseDispatches(syntheticEvent); |
| 6031 | |
| 6032 | return syntheticEvent; |
| 6033 | } |
| 6034 | |
| 6035 | return null; |
| 6036 | } |
| 6037 | |
| 6038 | /** |
| 6039 | * This plugin creates an `onSelect` event that normalizes select events |
no test coverage detected