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

interface Range {
    END_TO_END: number;
    END_TO_START: number;
    START_TO_END: number;
    START_TO_START: number;
    collapsed: boolean;
    commonAncestorContainer: Node;
    endContainer: Node;
    endOffset: number;
    startContainer: Node;
    startOffset: number;
    cloneContents(): DocumentFragment;
    cloneRange(): Range;
    collapse(toStart?): void;
    compareBoundaryPoints(how, sourceRange): number;
    comparePoint(node, offset): number;
    createContextualFragment(fragment): DocumentFragment;
    deleteContents(): void;
    detach(): void;
    extractContents(): DocumentFragment;
    getBoundingClientRect(): DOMRect;
    getClientRects(): DOMRectList;
    insertNode(node): void;
    intersectsNode(node): boolean;
    isPointInRange(node, offset): boolean;
    selectNode(node): void;
    selectNodeContents(node): void;
    setEnd(node, offset): void;
    setEndAfter(node): void;
    setEndBefore(node): void;
    setStart(node, offset): void;
    setStartAfter(node): void;
    setStartBefore(node): void;
    surroundContents(newParent): void;
    toString(): string;
}

Hierarchy

Properties

END_TO_END: number
END_TO_START: number
START_TO_END: number
START_TO_START: number
collapsed: boolean

Returns true if range is collapsed, and false otherwise.

commonAncestorContainer: Node

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

endContainer: Node

Returns range's end node.

endOffset: number

Returns range's end offset.

startContainer: Node

Returns range's start node.

startOffset: number

Returns range's start offset.

Methods

  • Returns Range

  • Parameters

    • Optional toStart: boolean

    Returns void

  • Parameters

    • how: number
    • sourceRange: Range

    Returns 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

  • Parameters

    • fragment: string

    Returns DocumentFragment

  • Returns void

  • Returns void

  • Returns DOMRect

  • Returns DOMRectList

  • Parameters

    Returns void

  • Returns whether range intersects node.

    Parameters

    Returns boolean

  • Parameters

    • node: Node
    • offset: number

    Returns boolean

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • node: Node
    • offset: number

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • node: Node
    • offset: number

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Returns string

Generated using TypeDoc