A Range object that will be added to the selection.
Read only: Returns the Node in which the selection begins.
Read only: Returns a number representing the offset of the selection's anchor within the anchorNode.
Read only: Returns a number representing the offset of the selection's anchor within the anchorNode. If anchorNode is a text node, this is the number of characters within anchorNode preceding the anchor. If anchorNode is an element, this is the number of child nodes of the anchorNode preceding the anchor.
Collapses the current selection to a single point.
Collapses the current selection to a single point.
The caret location will be within this node.
The offset in parentNode to which the selection will be collapsed.
Collapses the selection to the end of the last range in the selection.
Collapses the selection to the start of the first range in the selection.
Indicates if a certain node is part of the selection.
Indicates if a certain node is part of the selection.
The node that is being looked for whether it is part of the selection
When true, containsNode() returns true when a part of the node is part of the selection. When false, containsNode() only returns true when the entire node is part of the selection.
Deletes the selection's content from the document.
Moves the focus of the selection to a specified point.
Moves the focus of the selection to a specified point.
The node within which the focus will be moved.
The offset position within parentNode where the focus will be moved to.
Read only: Returns the Node in which the selection ends.
Read only: Returns a number representing the offset of the selection's anchor within the focusNode.
Read only: Returns a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of child nodes of the focusNode preceding the focus.
Returns a Range object representing one of the ranges currently selected.
Read only: Returns a Boolean indicating whether the selection's start and end points are at the same position.
Changes the current selection.
Changes the current selection.
The type of change to apply. Specify "move" to move the current cursor position or "extend" to extend the current selection.
The direction in which to adjust the current selection. You can specify "forward" or "backward" to adjust in the appropriate direction based on the language at the selection point. If you want to adjust in a specific direction, you can specify "left" or "right".
The distance to adjust the current selection or cursor position. You can move by "character", "word", "sentence", "line", "paragraph", "lineboundary", "sentenceboundary", "paragraphboundary", or "documentboundary".
Read only: Returns the number of ranges in the selection.
Removes all ranges from the selection.
Removes a range from the selection.
Adds all the children of the specified node to the selection.
A Selection object represents the range of text selected by the user or the current position of the caret. To obtain a Selection object for examination or modification, call window.getSelection().
A user may make a selection from left to right (in document order) or right to left (reverse of document order). The anchor is where the user began the selection and the focus is where the user ends the selection. If you make a selection with a desktop mouse, the anchor is placed where you pressed the mouse button and the focus is placed where you released the mouse button. Anchor and focus should not be confused with the start and end positions of a selection, since anchor can be placed before the focus or vice versa, depending on the direction you made your selection.
https://developer.mozilla.org/en-US/docs/Web/API/Selection