getSelection() — react Function Reference
Architecture documentation for the getSelection() function in SelectEventPlugin.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD ab574a65_e1cf_4bff_0d86_6d96e2a1fa23["getSelection()"] b8a5c95d_02fb_4719_0efd_4463f2546996["SelectEventPlugin.js"] ab574a65_e1cf_4bff_0d86_6d96e2a1fa23 -->|defined in| b8a5c95d_02fb_4719_0efd_4463f2546996 4c50b416_304e_a759_8f8d_e22e46f2d54d["constructSelectEvent()"] 4c50b416_304e_a759_8f8d_e22e46f2d54d -->|calls| ab574a65_e1cf_4bff_0d86_6d96e2a1fa23 15b961e4_5bdf_3cdf_6282_36a44dfc92b2["getSelection()"] ab574a65_e1cf_4bff_0d86_6d96e2a1fa23 -->|calls| 15b961e4_5bdf_3cdf_6282_36a44dfc92b2 a96fa181_7474_eda8_7c38_1e173c424b26["hasSelectionCapabilities()"] ab574a65_e1cf_4bff_0d86_6d96e2a1fa23 -->|calls| a96fa181_7474_eda8_7c38_1e173c424b26 style ab574a65_e1cf_4bff_0d86_6d96e2a1fa23 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js lines 57–74
function getSelection(node: any) {
if ('selectionStart' in node && hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd,
};
} else {
const win =
(node.ownerDocument && node.ownerDocument.defaultView) || window;
const selection = win.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset,
};
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does getSelection() do?
getSelection() is a function in the react codebase, defined in packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js.
Where is getSelection() defined?
getSelection() is defined in packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js at line 57.
What does getSelection() call?
getSelection() calls 2 function(s): getSelection, hasSelectionCapabilities.
What calls getSelection()?
getSelection() is called by 1 function(s): constructSelectEvent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free