Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/evt/lib/types/lib.dom.ts>Selection

💧EventEmitter's typesafe replacement
Go to Latest
interface Selection
import { type Selection } from "https://deno.land/x/evt@v2.5.6/lib/types/lib.dom.ts";

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().

Properties

readonly
anchorNode: Node | null
readonly
anchorOffset: number
readonly
focusNode: Node | null
readonly
focusOffset: number
readonly
isCollapsed: boolean
readonly
rangeCount: number
readonly
type: string

Methods

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