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().
interface Selection {
readonly anchorNode: Node | null;
readonly anchorOffset: number;
readonly focusNode: Node | null;
readonly focusOffset: number;
readonly isCollapsed: boolean;
readonly rangeCount: number;
readonly type: string;
addRange(range: Range): void;
collapseToEnd(): void;
collapseToStart(): void;
deleteFromDocument(): void;
empty(): void;
getRangeAt(index: number): Range;
removeAllRanges(): void;
removeRange(range: Range): void;
selectAllChildren(node: Node): void;
toString(): string;
}