Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Range

A fragment of a document that can contain nodes and parts of text nodes.

Hierarchy

Index

Properties

AbstractRange

AbstractRange: { constructor: any; prototype: AbstractRange }

Type declaration

Readonly END_TO_END

END_TO_END: number

Readonly END_TO_START

END_TO_START: number

Readonly START_TO_END

START_TO_END: number

Readonly START_TO_START

START_TO_START: number

Readonly collapsed

collapsed: boolean

Returns true if range is collapsed, and false otherwise.

Readonly commonAncestorContainer

commonAncestorContainer: Node

Returns the node, furthest away from the document, that is an ancestor of both range's start node and end node.

Readonly endContainer

endContainer: Node

Returns range's end node.

Readonly endOffset

endOffset: number

Returns range's end offset.

Readonly startContainer

startContainer: Node

Returns range's start node.

Readonly startOffset

startOffset: number

Returns range's start offset.

Methods

cloneContents

  • Returns DocumentFragment

cloneRange

  • Returns Range

collapse

  • collapse(toStart?: boolean): void
  • Parameters

    • Optional toStart: boolean

    Returns void

compareBoundaryPoints

  • compareBoundaryPoints(how: number, sourceRange: Range): number
  • Parameters

    • how: number
    • sourceRange: Range

    Returns number

comparePoint

  • comparePoint(node: Node, offset: number): number
  • Returns −1 if the point is before the range, 0 if the point is in the range, and 1 if the point is after the range.

    Parameters

    • node: Node
    • offset: number

    Returns number

createContextualFragment

  • Parameters

    • fragment: string

    Returns DocumentFragment

deleteContents

  • deleteContents(): void
  • Returns void

detach

  • detach(): void
  • Returns void

extractContents

  • Returns DocumentFragment

getBoundingClientRect

  • Returns DOMRect

getClientRects

  • Returns DOMRectList

insertNode

  • insertNode(node: Node): void
  • Parameters

    Returns void

intersectsNode

  • intersectsNode(node: Node): boolean
  • Returns whether range intersects node.

    Parameters

    Returns boolean

isPointInRange

  • isPointInRange(node: Node, offset: number): boolean
  • Parameters

    • node: Node
    • offset: number

    Returns boolean

selectNode

  • selectNode(node: Node): void
  • Parameters

    Returns void

selectNodeContents

  • selectNodeContents(node: Node): void
  • Parameters

    Returns void

setEnd

  • setEnd(node: Node, offset: number): void
  • Parameters

    • node: Node
    • offset: number

    Returns void

setEndAfter

  • setEndAfter(node: Node): void
  • Parameters

    Returns void

setEndBefore

  • setEndBefore(node: Node): void
  • Parameters

    Returns void

setStart

  • setStart(node: Node, offset: number): void
  • Parameters

    • node: Node
    • offset: number

    Returns void

setStartAfter

  • setStartAfter(node: Node): void
  • Parameters

    Returns void

setStartBefore

  • setStartBefore(node: Node): void
  • Parameters

    Returns void

surroundContents

  • surroundContents(newParent: Node): void
  • Parameters

    Returns void

toString

  • toString(): string
  • Returns string

Generated using TypeDoc