Home / Function/ setSelection() — react Function Reference

setSelection() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  8ff85b49_fa19_b78a_6c6a_8dda56ae4f95["setSelection()"]
  61ae92ed_59ee_0d03_f7cc_6c7bd8c060f5["ReactInputSelection.js"]
  8ff85b49_fa19_b78a_6c6a_8dda56ae4f95 -->|defined in| 61ae92ed_59ee_0d03_f7cc_6c7bd8c060f5
  3ffa57aa_7550_476a_22f1_45c9f6827530["restoreSelection()"]
  3ffa57aa_7550_476a_22f1_45c9f6827530 -->|calls| 8ff85b49_fa19_b78a_6c6a_8dda56ae4f95
  51f6074d_96a6_e994_0a5d_3d79a9aab945["setOffsets()"]
  8ff85b49_fa19_b78a_6c6a_8dda56ae4f95 -->|calls| 51f6074d_96a6_e994_0a5d_3d79a9aab945
  style 8ff85b49_fa19_b78a_6c6a_8dda56ae4f95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactInputSelection.js lines 186–199

export function setSelection(input, offsets) {
  const start = offsets.start;
  let end = offsets.end;
  if (end === undefined) {
    end = start;
  }

  if ('selectionStart' in input) {
    input.selectionStart = start;
    input.selectionEnd = Math.min(end, input.value.length);
  } else {
    setOffsets(input, offsets);
  }
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does setSelection() do?
setSelection() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactInputSelection.js.
Where is setSelection() defined?
setSelection() is defined in packages/react-dom-bindings/src/client/ReactInputSelection.js at line 186.
What does setSelection() call?
setSelection() calls 1 function(s): setOffsets.
What calls setSelection()?
setSelection() is called by 1 function(s): restoreSelection.

Analyze Your Own Codebase

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

Try Supermodel Free