MCPcopy Create free account
hub / github.com/microsoft/SandDance / getEventTarget

Function getEventTarget

docs/external/js/react-dom.development.js:3447–3459  ·  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

3445 */
3446
3447 function getEventTarget(nativeEvent) {
3448 // Fallback to nativeEvent.srcElement for IE9
3449 // https://github.com/facebook/react/issues/12506
3450 var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963
3451
3452 if (target.correspondingUseElement) {
3453 target = target.correspondingUseElement;
3454 } // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
3455 // @see http://www.quirksmode.org/js/events_properties.html
3456
3457
3458 return target.nodeType === TEXT_NODE ? target.parentNode : target;
3459 }
3460
3461 /**
3462 * Checks if an event is supported in the current execution environment.

Callers 3

handleTopLevelFunction · 0.85
attemptToDispatchEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected