Class InputRange

A fragment of a document that can contain only pieces of a single text node. Does not implement Range methods that operate with other nodes or directly mutate the contents of the Range.

Hierarchy

  • InputRange

Implements

Constructors

  • Construct a new InputRange.

    Parameters

    • element: InputElement

      The target input element that contains the content for the range.

    • startOffset: number = 0

      The inclusive 0-based start index for the range. Will be adjusted to fit in the input contents.

    • endOffset: number = startOffset

      The exclusive 0-based end index for the range. Will be adjusted to fit in the input contents.

    Returns InputRange

Accessors

Methods

  • Create a new range from the current user selection. If the input is not focused, the range will just be the start of the input (offsets 0 to 0).

    This can be used to get the caret coordinates: if the resulting range is collapsed, the location of the getBoundingClientRect will be the location of the caret caret (note, however, that the width will be 0 in this case).

    Parameters

    Returns InputRange

  • Collapse this range to one side.

    Parameters

    • toStart: boolean = false

      If true, will collapse to the start side. Otherwise, will collapse to the end.

    Returns void

Generated using TypeDoc