Home / File/ SelectEventPlugin.js — react Source File

SelectEventPlugin.js — react Source File

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

File javascript BabelCompiler Validation 19 imports 1 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  b8a5c95d_02fb_4719_0efd_4463f2546996["SelectEventPlugin.js"]
  441cc620_4cb4_9cec_2f7a_93b0594f4707["PluginModuleType.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 441cc620_4cb4_9cec_2f7a_93b0594f4707
  4e9925e9_ca97_8d79_6ffa_a9347d262615["DOMEventNames.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 4e9925e9_ca97_8d79_6ffa_a9347d262615
  816b54e5_c63c_f8b2_68e8_0c637e281f03["DOMPluginEventSystem.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 816b54e5_c63c_f8b2_68e8_0c637e281f03
  e8ab76a4_05c2_cc4f_1bc2_aec96b5daa8c["EventSystemFlags.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> e8ab76a4_05c2_cc4f_1bc2_aec96b5daa8c
  3632e1a4_9237_b583_7260_c67d392d0405["ReactSyntheticEventType.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 3632e1a4_9237_b583_7260_c67d392d0405
  9c3d71d9_41af_c5e7_cd35_d25bbf6cf606["SyntheticEvent.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606
  d1896f19_d30c_0443_48d3_c9e718f95b77["isTextInputElement.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> d1896f19_d30c_0443_48d3_c9e718f95b77
  e1c602b7_5988_fa00_bb9f_269d66d38107["EventRegistry.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  db2a0ac3_1faf_8e02_55e8_f299ce8da5e9["registerTwoPhaseEvent"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> db2a0ac3_1faf_8e02_55e8_f299ce8da5e9
  fa8c5082_5952_1b00_ab76_4bbec8487a1d["getActiveElement.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> fa8c5082_5952_1b00_ab76_4bbec8487a1d
  73ae0fb8_77c3_8d4a_406e_dfdbac35c58c["getActiveElement"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 73ae0fb8_77c3_8d4a_406e_dfdbac35c58c
  799a7834_f34c_8596_4026_015681eee732["ReactDOMComponentTree.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 799a7834_f34c_8596_4026_015681eee732
  61ae92ed_59ee_0d03_f7cc_6c7bd8c060f5["ReactInputSelection.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> 61ae92ed_59ee_0d03_f7cc_6c7bd8c060f5
  a96fa181_7474_eda8_7c38_1e173c424b26["hasSelectionCapabilities"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> a96fa181_7474_eda8_7c38_1e173c424b26
  style b8a5c95d_02fb_4719_0efd_4463f2546996 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.
 *
 * @flow
 */

import type {AnyNativeEvent} from '../PluginModuleType';
import type {DOMEventName} from '../DOMEventNames';
import type {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {ReactSyntheticEvent} from '../ReactSyntheticEventType';

import {canUseDOM} from 'shared/ExecutionEnvironment';
import {SyntheticEvent} from '../../events/SyntheticEvent';
import isTextInputElement from '../isTextInputElement';
import shallowEqual from 'shared/shallowEqual';

import {registerTwoPhaseEvent} from '../EventRegistry';
import getActiveElement from '../../client/getActiveElement';
import {getNodeFromInstance} from '../../client/ReactDOMComponentTree';
import {hasSelectionCapabilities} from '../../client/ReactInputSelection';
import {DOCUMENT_NODE} from '../../client/HTMLNodeType';
import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';

const skipSelectionChangeEvent =
  canUseDOM && 'documentMode' in document && document.documentMode <= 11;

function registerEvents() {
  registerTwoPhaseEvent('onSelect', [
    'focusout',
    'contextmenu',
    'dragend',
    'focusin',
    'keydown',
    'keyup',
    'mousedown',
    'mouseup',
    'selectionchange',
  ]);
}

let activeElement = null;
let activeElementInst = null;
let lastSelection = null;
let mouseDown = false;

/**
 * Get an object which is a unique representation of the current selection.
 *
 * The return value will not be consistent across nodes or browsers, but
 * two identical selections on the same node will return identical objects.
 */
function getSelection(node: any) {
  if ('selectionStart' in node && hasSelectionCapabilities(node)) {
    return {
      start: node.selectionStart,
// ... (150 more lines)

Domain

Subdomains

Frequently Asked Questions

What does SelectEventPlugin.js do?
SelectEventPlugin.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 SelectEventPlugin.js?
SelectEventPlugin.js defines 5 function(s): constructSelectEvent, extractEvents, getEventTargetDocument, getSelection, registerEvents.
What does SelectEventPlugin.js depend on?
SelectEventPlugin.js imports 19 module(s): DOMEventNames.js, DOMPluginEventSystem.js, EventRegistry.js, EventSystemFlags.js, ExecutionEnvironment, HTMLNodeType.js, PluginModuleType.js, ReactDOMComponentTree.js, and 11 more.
What files import SelectEventPlugin.js?
SelectEventPlugin.js is imported by 1 file(s): DOMPluginEventSystem.js.
Where is SelectEventPlugin.js in the architecture?
SelectEventPlugin.js is located at packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/events/plugins).

Analyze Your Own Codebase

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

Try Supermodel Free