Home / File/ getEventTarget.js — react Source File

getEventTarget.js — react Source File

Architecture documentation for getEventTarget.js, a javascript file in the react codebase. 1 imports, 3 dependents.

File javascript BabelCompiler Validation 1 imports 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  ad61f88d_874a_73e7_6d93_c79d0d2caa0d["getEventTarget.js"]
  79306122_0617_c4ea_94ca_a596414f3150["HTMLNodeType.js"]
  ad61f88d_874a_73e7_6d93_c79d0d2caa0d --> 79306122_0617_c4ea_94ca_a596414f3150
  816b54e5_c63c_f8b2_68e8_0c637e281f03["DOMPluginEventSystem.js"]
  816b54e5_c63c_f8b2_68e8_0c637e281f03 --> ad61f88d_874a_73e7_6d93_c79d0d2caa0d
  59469541_eb24_2e4d_9b1d_8719abe8ae49["ReactDOMEventListener.js"]
  59469541_eb24_2e4d_9b1d_8719abe8ae49 --> ad61f88d_874a_73e7_6d93_c79d0d2caa0d
  ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7["ChangeEventPlugin.js"]
  ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7 --> ad61f88d_874a_73e7_6d93_c79d0d2caa0d
  style ad61f88d_874a_73e7_6d93_c79d0d2caa0d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import {TEXT_NODE} from '../client/HTMLNodeType';

/**
 * 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.
 */
function getEventTarget(nativeEvent) {
  // Fallback to nativeEvent.srcElement for IE9
  // https://github.com/facebook/react/issues/12506
  let target = nativeEvent.target || nativeEvent.srcElement || window;

  // Normalize SVG <use> element events #4963
  if (target.correspondingUseElement) {
    target = target.correspondingUseElement;
  }

  // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  // @see http://www.quirksmode.org/js/events_properties.html
  return target.nodeType === TEXT_NODE ? target.parentNode : target;
}

export default getEventTarget;

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does getEventTarget.js do?
getEventTarget.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in getEventTarget.js?
getEventTarget.js defines 1 function(s): getEventTarget.
What does getEventTarget.js depend on?
getEventTarget.js imports 1 module(s): HTMLNodeType.js.
What files import getEventTarget.js?
getEventTarget.js is imported by 3 file(s): ChangeEventPlugin.js, DOMPluginEventSystem.js, ReactDOMEventListener.js.
Where is getEventTarget.js in the architecture?
getEventTarget.js is located at packages/react-dom-bindings/src/events/getEventTarget.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/events).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free