# class Range

#### package js.html

Available on HTML5

The `Range` interface represents a fragment of a document that can contain nodes and parts of text nodes.

Documentation Range by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

https://developer.mozilla.org/en-US/docs/Web/API/Range

### Constructor

###

`new ()`

Throws:

`null` | DOMError

### Variables

###

`read onlycollapsed:Bool`

Returns a `Boolean` indicating whether the range's start and end points are at the same position.

###

`read onlycommonAncestorContainer:Node`

Returns the deepest `Node` that contains the `startContainer` and `endContainer` nodes.

###

`read onlyendContainer:Node`

Returns the `Node` within which the `Range` ends.

###

`read onlyendOffset:Int`

Returns a number representing where in the `endContainer` the `Range` ends.

###

`read onlystartContainer:Node`

Returns the `Node` within which the `Range` starts.

###

`read onlystartOffset:Int`

Returns a number representing where in the `startContainer` the `Range` starts.

### Methods

###

`cloneContents ():DocumentFragment`

Throws:

`null` | DOMError

###

`cloneRange ():Range`

###

`collapse (toStart:Bool = false):Void`

###

`compareBoundaryPoints (how:Int, sourceRange:Range):Int`

Throws:

`null` | DOMError

###

`comparePoint (node:Node, offset:Int):Int`

Throws:

`null` | DOMError

###

`createContextualFragment (fragment:String):DocumentFragment`

Throws:

`null` | DOMError

###

`deleteContents ():Void`

Throws:

`null` | DOMError

###

`detach ():Void`

###

`extractContents ():DocumentFragment`

Throws:

`null` | DOMError

###

`getBoundingClientRect ():DOMRect`

###

`getClientRects ():DOMRectList`

###

`insertNode (node:Node):Void`

Throws:

`null` | DOMError

###

`intersectsNode (node:Node):Bool`

Throws:

`null` | DOMError

###

`isPointInRange (node:Node, offset:Int):Bool`

Throws:

`null` | DOMError

###

`selectNode (refNode:Node):Void`

Throws:

`null` | DOMError

###

`selectNodeContents (refNode:Node):Void`

Throws:

`null` | DOMError

###

`setEnd (refNode:Node, offset:Int):Void`

Throws:

`null` | DOMError

###

`setEndAfter (refNode:Node):Void`

Throws:

`null` | DOMError

###

`setEndBefore (refNode:Node):Void`

Throws:

`null` | DOMError

###

`setStart (refNode:Node, offset:Int):Void`

Throws:

`null` | DOMError

###

`setStartAfter (refNode:Node):Void`

Throws:

`null` | DOMError

###

`setStartBefore (refNode:Node):Void`

Throws:

`null` | DOMError

###

`surroundContents (newParent:Node):Void`

Throws:

`null` | DOMError

### Static variables

###

`staticinline read onlyEND_TO_END:Int = 2`

###

`staticinline read onlyEND_TO_START:Int = 3`

###

`staticinline read onlySTART_TO_END:Int = 1`

###

`staticinline read onlySTART_TO_START:Int = 0`