Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • Selection

Index

Properties

Readonly anchorNode

anchorNode: Node | null

Readonly anchorOffset

anchorOffset: number

Readonly focusNode

focusNode: Node | null

Readonly focusOffset

focusOffset: number

Readonly isCollapsed

isCollapsed: boolean

Readonly rangeCount

rangeCount: number

Readonly type

type: string

Methods

addRange

  • addRange(range: Range): void
  • Parameters

    Returns void

collapse

  • collapse(node: Node | null, offset?: number): void
  • Parameters

    • node: Node | null
    • Optional offset: number

    Returns void

collapseToEnd

  • collapseToEnd(): void
  • Returns void

collapseToStart

  • collapseToStart(): void
  • Returns void

containsNode

  • containsNode(node: Node, allowPartialContainment?: boolean): boolean
  • Parameters

    • node: Node
    • Optional allowPartialContainment: boolean

    Returns boolean

deleteFromDocument

  • deleteFromDocument(): void
  • Returns void

empty

  • empty(): void
  • Returns void

extend

  • extend(node: Node, offset?: number): void
  • Parameters

    • node: Node
    • Optional offset: number

    Returns void

getRangeAt

  • getRangeAt(index: number): Range
  • Parameters

    • index: number

    Returns Range

removeAllRanges

  • removeAllRanges(): void
  • Returns void

removeRange

  • removeRange(range: Range): void
  • Parameters

    Returns void

selectAllChildren

  • selectAllChildren(node: Node): void
  • Parameters

    Returns void

setBaseAndExtent

  • setBaseAndExtent(anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number): void
  • Parameters

    • anchorNode: Node
    • anchorOffset: number
    • focusNode: Node
    • focusOffset: number

    Returns void

setPosition

  • setPosition(node: Node | null, offset?: number): void
  • Parameters

    • node: Node | null
    • Optional offset: number

    Returns void

toString

  • toString(): string
  • Returns string

Generated using TypeDoc