MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getEventTarget

Function getEventTarget

code/controlled-uncontrolled/public/app.js:3014–3025  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

3012 * @return {DOMEventTarget} Target node.
3013 */
3014function getEventTarget(nativeEvent) {
3015 var target = nativeEvent.target || window;
3016
3017 // Normalize SVG <use> element events #4963
3018 if (target.correspondingUseElement) {
3019 target = target.correspondingUseElement;
3020 }
3021
3022 // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
3023 // @see http://www.quirksmode.org/js/events_properties.html
3024 return target.nodeType === TEXT_NODE ? target.parentNode : target;
3025}
3026
3027/**
3028 * Checks if an event is supported in the current execution environment.

Callers 3

handleTopLevelFunction · 0.70
dispatchEventFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected