Skip to content

Selection

Defined in: uzumaki.d.ts:503

Live view of a window’s text selection. Read endpoints through anchor / focus; mutate via collapse, extend, setBaseAndExtent, or empty. Programmatic mutations emit selectionchange on the window.

new Selection(): Selection

Selection

get anchor(): UzSelectionEndpoint | null

Defined in: uzumaki.d.ts:508

UzSelectionEndpoint | null


get focus(): UzSelectionEndpoint | null

Defined in: uzumaki.d.ts:509

UzSelectionEndpoint | null


get isActive(): boolean

Defined in: uzumaki.d.ts:506

boolean


get isCollapsed(): boolean

Defined in: uzumaki.d.ts:507

boolean


get text(): string

Defined in: uzumaki.d.ts:510

string

collapse(node, offset): void

Defined in: uzumaki.d.ts:511

UzNode

number

void


empty(): void

Defined in: uzumaki.d.ts:514

void


extend(node, offset): void

Defined in: uzumaki.d.ts:512

UzNode

number

void


getRange(): Range | null

Defined in: uzumaki.d.ts:524

Snapshot the current selection as a detached Range. Returns null when there is no active selection.

Range | null


selectAll(container): void

Defined in: uzumaki.d.ts:519

Replace the selection with all text inside container. Equivalent to setRange(window.createRange().selectNodeContents(container)).

UzNode

void


set(anchor, focus?): void

Defined in: uzumaki.d.ts:513

UzSelectionEndpointInit

UzSelectionEndpointInit

void


setRange(range): void

Defined in: uzumaki.d.ts:529

Apply a Range as the active selection. The range’s start becomes the anchor and the end becomes the focus.

Range

void