* Gets the target node from a native browser event by accounting for * inconsistencies in browser DOM APIs. * * @param {object} nativeEvent Native browser event. * @return {DOMEventTarget} Target node.
(nativeEvent)
| 7017 | */ |
| 7018 | |
| 7019 | function getEventTarget(nativeEvent) { |
| 7020 | // Fallback to nativeEvent.srcElement for IE9 |
| 7021 | // https://github.com/facebook/react/issues/12506 |
| 7022 | var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963 |
| 7023 | |
| 7024 | if (target.correspondingUseElement) { |
| 7025 | target = target.correspondingUseElement; |
| 7026 | } // Safari may fire events on text nodes (Node.TEXT_NODE is 3). |
| 7027 | // @see http://www.quirksmode.org/js/events_properties.html |
| 7028 | |
| 7029 | |
| 7030 | return target.nodeType === TEXT_NODE ? target.parentNode : target; |
| 7031 | } |
| 7032 | |
| 7033 | /** |
| 7034 | * Checks if an event is supported in the current execution environment. |
no outgoing calls
no test coverage detected