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

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

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

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