Interface Range
interface Range {
collapsed: boolean;
commonAncestorContainer: Node;
END_TO_END: 2;
END_TO_START: 3;
endContainer: Node;
endOffset: number;
START_TO_END: 1;
START_TO_START: 0;
startContainer: Node;
startOffset: number;
cloneContents(): DocumentFragment;
cloneRange(): Range;
collapse(toStart?: boolean): void;
compareBoundaryPoints(how: number, sourceRange: Range): number;
comparePoint(node: Node, offset: number): number;
createContextualFragment(string: string): DocumentFragment;
deleteContents(): void;
detach(): void;
extractContents(): DocumentFragment;
getBoundingClientRect(): DOMRect;
getClientRects(): DOMRectList;
insertNode(node: Node): void;
intersectsNode(node: Node): boolean;
isPointInRange(node: Node, offset: number): boolean;
selectNode(node: Node): void;
selectNodeContents(node: Node): void;
setEnd(node: Node, offset: number): void;
setEndAfter(node: Node): void;
setEndBefore(node: Node): void;
setStart(node: Node, offset: number): void;
setStartAfter(node: Node): void;
setStartBefore(node: Node): void;
surroundContents(newParent: Node): void;
toString(): string;
}
collapsed: boolean;
commonAncestorContainer: Node;
END_TO_END: 2;
END_TO_START: 3;
endContainer: Node;
endOffset: number;
START_TO_END: 1;
START_TO_START: 0;
startContainer: Node;
startOffset: number;
cloneContents(): DocumentFragment;
cloneRange(): Range;
collapse(toStart?: boolean): void;
compareBoundaryPoints(how: number, sourceRange: Range): number;
comparePoint(node: Node, offset: number): number;
createContextualFragment(string: string): DocumentFragment;
deleteContents(): void;
detach(): void;
extractContents(): DocumentFragment;
getBoundingClientRect(): DOMRect;
getClientRects(): DOMRectList;
insertNode(node: Node): void;
intersectsNode(node: Node): boolean;
isPointInRange(node: Node, offset: number): boolean;
selectNode(node: Node): void;
selectNodeContents(node: Node): void;
setEnd(node: Node, offset: number): void;
setEndAfter(node: Node): void;
setEndBefore(node: Node): void;
setStart(node: Node, offset: number): void;
setStartAfter(node: Node): void;
setStartBefore(node: Node): void;
surroundContents(newParent: Node): void;
toString(): string;
}
Hierarchy
- AbstractRange
- Range (view full)
Index
Properties
Methods
cloneContents
cloneRange
collapse
compareBoundaryPoints
comparePoint
createContextualFragment
deleteContents
detach
extractContents
getBoundingClientRect
getClientRects
insertNode
intersectsNode
isPointInRange
selectNode
selectNodeContents
setEnd
setEndAfter
setEndBefore
setStart
setStartAfter
setStartBefore
surroundContents
toString
Properties
Readonly
collapsed
collapsed: boolean
Returns true if range is collapsed, and false otherwise.
Readonly
commonAncestorContainer
Returns the node, furthest away from the document, that is an ancestor of both range's start node and end node.
Readonly
END_TO_END
END_TO_END : 2
Readonly
END_TO_START
END_TO_START : 3
Readonly
endContainer
Returns range's end node.
Readonly
endOffset
endOffset : number
Returns range's end offset.
Readonly
START_TO_END
START_TO_END : 1
Readonly
START_TO_START
START_TO_START : 0
Readonly
startContainer
Returns range's start node.
Readonly
startOffset
startOffset : number
Returns range's start offset.
Methods
cloneContents
- clone
Contents (): DocumentFragment Returns DocumentFragment
cloneRange
collapse
compareBoundaryPoints
- compare
Boundary (how, sourceRange): numberPoints Parameters
- how: number
- sourceRange: Range
Returns number
comparePoint
- compare
Point (node, offset): 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
- create
Contextual (string): DocumentFragmentFragment Parameters
- string: string
Returns DocumentFragment
deleteContents
detach
extractContents
- extract
Contents (): DocumentFragment Returns DocumentFragment
getBoundingClientRect
getClientRects
- get
Client (): DOMRectListRects Returns DOMRectList
insertNode
- insert
Node (node): void Parameters
- node: Node
Returns void
intersectsNode
- intersects
Node (node): boolean Returns whether range intersects node.
Parameters
- node: Node
Returns boolean
isPointInRange
- is
Point (node, offset): booleanIn Range Parameters
- node: Node
- offset: number
Returns boolean
selectNode
- select
Node (node): void Parameters
- node: Node
Returns void
selectNodeContents
- select
Node (node): voidContents Parameters
- node: Node
Returns void
setEnd
- set
End (node, offset): void Parameters
- node: Node
- offset: number
Returns void
setEndAfter
- set
End (node): voidAfter Parameters
- node: Node
Returns void
setEndBefore
- set
End (node): voidBefore Parameters
- node: Node
Returns void
setStart
- set
Start (node, offset): void Parameters
- node: Node
- offset: number
Returns void
setStartAfter
- set
Start (node): voidAfter Parameters
- node: Node
Returns void
setStartBefore
- set
Start (node): voidBefore Parameters
- node: Node
Returns void
surroundContents
- surround
Contents (newParent): void Parameters
- newParent: Node
Returns void
A fragment of a document that can contain nodes and parts of text nodes.
MDN Reference