Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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;
collapse(node: Node | null, offset?: number): void;
collapseToEnd(): void;
collapseToStart(): void;
containsNode(node: Node, allowPartialContainment?: boolean): boolean;
deleteFromDocument(): void;
empty(): void;
extend(node: Node, offset?: number): void;
getRangeAt(index: number): Range;
removeAllRanges(): void;
removeRange(range: Range): void;
selectAllChildren(node: Node): void;
setBaseAndExtent(
anchorNode: Node,
anchorOffset: number,
focusNode: Node,
focusOffset: number,
): void;
setPosition(node: Node | null, offset?: number): void;
toString(): string;
}
var Selection: {
prototype: Selection;
new (): Selection;
toString(): string;
}
;

§Properties

§
readonly anchorNode: Node | null
[src]
§
readonly anchorOffset: number
[src]
§
readonly focusNode: Node | null
[src]
§
readonly focusOffset: number
[src]
§
readonly isCollapsed: boolean
[src]
§
readonly rangeCount: number
[src]
§
readonly type: string
[src]

§Methods

§
addRange(range: Range): void
[src]
§
collapse(node: Node | null, offset?: number): void
[src]
§
collapseToEnd(): void
[src]
§
collapseToStart(): void
[src]
§
containsNode(node: Node, allowPartialContainment?: boolean): boolean
[src]
§
deleteFromDocument(): void
[src]
§
empty(): void
[src]
§
extend(node: Node, offset?: number): void
[src]
§
getRangeAt(index: number): Range
[src]
§
removeAllRanges(): void
[src]
§
removeRange(range: Range): void
[src]
§
selectAllChildren(node: Node): void
[src]
§
setBaseAndExtent(
anchorNode: Node,
anchorOffset: number,
focusNode: Node,
focusOffset: number,
): void
[src]
§
setPosition(node: Node | null, offset?: number): void
[src]
§
toString(): string
[src]