Home / Function/ getSelection() — react Function Reference

getSelection() — react Function Reference

Architecture documentation for the getSelection() function in ReactInputSelection.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  15b961e4_5bdf_3cdf_6282_36a44dfc92b2["getSelection()"]
  61ae92ed_59ee_0d03_f7cc_6c7bd8c060f5["ReactInputSelection.js"]
  15b961e4_5bdf_3cdf_6282_36a44dfc92b2 -->|defined in| 61ae92ed_59ee_0d03_f7cc_6c7bd8c060f5
  4cfcf5ec_fe17_9b20_94a6_11e3787af2e1["getSelectionInformation()"]
  4cfcf5ec_fe17_9b20_94a6_11e3787af2e1 -->|calls| 15b961e4_5bdf_3cdf_6282_36a44dfc92b2
  ab574a65_e1cf_4bff_0d86_6d96e2a1fa23["getSelection()"]
  ab574a65_e1cf_4bff_0d86_6d96e2a1fa23 -->|calls| 15b961e4_5bdf_3cdf_6282_36a44dfc92b2
  f22fbac9_78b0_dbd3_6b8a_d487d7efa09e["getOffsets()"]
  15b961e4_5bdf_3cdf_6282_36a44dfc92b2 -->|calls| f22fbac9_78b0_dbd3_6b8a_d487d7efa09e
  style 15b961e4_5bdf_3cdf_6282_36a44dfc92b2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactInputSelection.js lines 163–178

export function getSelection(input) {
  let selection;

  if ('selectionStart' in input) {
    // Modern browser with input or textarea.
    selection = {
      start: input.selectionStart,
      end: input.selectionEnd,
    };
  } else {
    // Content editable or old IE textarea.
    selection = getOffsets(input);
  }

  return selection || {start: 0, end: 0};
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does getSelection() do?
getSelection() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactInputSelection.js.
Where is getSelection() defined?
getSelection() is defined in packages/react-dom-bindings/src/client/ReactInputSelection.js at line 163.
What does getSelection() call?
getSelection() calls 1 function(s): getOffsets.
What calls getSelection()?
getSelection() is called by 2 function(s): getSelection, getSelectionInformation.

Analyze Your Own Codebase

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

Try Supermodel Free