Range

package js.html

Available on js

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 also:

Static variables

staticinlineread onlyEND_TO_END:Int = 2

staticinlineread onlyEND_TO_START:Int = 3

staticinlineread onlySTART_TO_END:Int = 1

staticinlineread onlySTART_TO_START:Int = 0

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

Returns a DocumentFragment copying the nodes of a Range.

Throws:

null

DOMError

cloneRange():Range

Returns a Range object with boundary points identical to the cloned Range.

collapse(toStart:Bool = false):Void

Collapses the Range to one of its boundary points.

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

Compares the boundary points of the Range with another Range.

Throws:

null

DOMError

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

Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the Range.

Throws:

null

DOMError

createContextualFragment(fragment:String):DocumentFragment

Returns a DocumentFragment created from a given string of code.

Throws:

null

DOMError

deleteContents():Void

Removes the contents of a Range from the Document.

Throws:

null

DOMError

detach():Void

Releases the Range from use to improve performance.

extractContents():DocumentFragment

Moves contents of a Range from the document tree into a DocumentFragment.

Throws:

null

DOMError

getBoundingClientRect():DOMRect

Returns a DOMRect object which bounds the entire contents of the Range; this would be the union of all the rectangles returned by range.getClientRects().

getClientRects():DOMRectList

Returns a list of DOMRect objects that aggregates the results of Element.getClientRects() for all the elements in the Range.

insertNode(node:Node):Void

Insert a Node at the start of a Range.

Throws:

null

DOMError

intersectsNode(node:Node):Bool

Returns a boolean indicating whether the given node intersects the Range.

Throws:

null

DOMError

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

Returns a boolean indicating whether the given point is in the Range.

Throws:

null

DOMError

selectNode(refNode:Node):Void

Sets the Range to contain the Node and its contents.

Throws:

null

DOMError

selectNodeContents(refNode:Node):Void

Sets the Range to contain the contents of a Node.

Throws:

null

DOMError

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

Sets the end position of a Range.

Throws:

null

DOMError

setEndAfter(refNode:Node):Void

Sets the end position of a Range relative to another Node.

Throws:

null

DOMError

setEndBefore(refNode:Node):Void

Sets the end position of a Range relative to another Node.

Throws:

null

DOMError

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

Sets the start position of a Range.

Throws:

null

DOMError

setStartAfter(refNode:Node):Void

Sets the start position of a Range relative to another Node.

Throws:

null

DOMError

setStartBefore(refNode:Node):Void

Sets the start position of a Range relative to another Node.

Throws:

null

DOMError

surroundContents(newParent:Node):Void

Moves content of a Range into a new Node.

Throws:

null

DOMError

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/Range.html