Range

open class Range : AbstractRange(source)

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

MDN Reference

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface CompareMethod

Properties

Link copied to clipboard

The read-only collapsed property of the AbstractRange interface returns true if the range's start position and end position are the same.

Link copied to clipboard

The Range.commonAncestorContainer read-only property returns the deepest — or furthest down the document tree — Node that contains both boundary points of the Range.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The read-only endContainer property of the AbstractRange interface returns the Node in which the end of the range is located.

Link copied to clipboard

The endOffset property of the AbstractRange interface returns the offset into the end node of the range's end position.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The read-only startContainer property of the AbstractRange interface returns the start Node for the range.

Link copied to clipboard

The read-only startOffset property of the AbstractRange interface returns the offset into the start node of the range's start position.

Functions

Link copied to clipboard

The cloneContents() method of the Range interface copies the selected Node children of the range's Range/commonAncestorContainer and puts them in a new DocumentFragment object.

Link copied to clipboard

The Range.cloneRange() method returns a The returned clone is copied by value, not reference, so a change in either ``js-nolint cloneRange() `` None.

Link copied to clipboard
fun collapse(toStart: Boolean = definedExternally)

The collapse() method of the Range interface collapses the A collapsed Range is empty, containing no content, specifying a single-point in a DOM tree.

Link copied to clipboard

The compareBoundaryPoints() method of the Range interface compares the boundary points of the Range with those of another range.

Link copied to clipboard
fun comparePoint(node: Node, offset: Int): Short

The comparePoint() method of the Range interface determines whether a specified point is before, within, or after the Range.

Link copied to clipboard

The Range.createContextualFragment() method returns a XML fragment parsing algorithm with the start of the range (the parent of the selected node) as the context node.

Link copied to clipboard

The Range.deleteContents() method removes all completely-selected Node within this range from the document.

Link copied to clipboard
fun detach()

The Range.detach() method does nothing.

Link copied to clipboard

The extractContents() method of the Range interface is similar to a combination of Range.cloneContents() and Range.deleteContents().

Link copied to clipboard

The Range.getBoundingClientRect() method returns a DOMRect object that bounds the contents of the range; this is a rectangle enclosing the union of the bounding rectangles for all the elements in the range.

Link copied to clipboard

The Range.getClientRects() method returns a list of DOMRect objects representing the area of the screen occupied by the range.

Link copied to clipboard
fun insertNode(node: Node)

The Range.insertNode() method inserts a node at the start of the Range.

Link copied to clipboard

The Range.intersectsNode() method returns a boolean indicating whether the given Node intersects the Range.

Link copied to clipboard
fun isPointInRange(node: Node, offset: Int): Boolean

The isPointInRange() method of the Range interface determines whether a specified point is within the Range.

Link copied to clipboard
fun selectNode(node: Node)

The Range.selectNode() method sets the the parent of the referenceNode.

Link copied to clipboard

The Range.selectNodeContents() method sets the Range to contain the contents of a Node.

Link copied to clipboard
fun setEnd(node: Node, offset: Int)

The Range.setEnd() method sets the end position of a Range to be located at the given offset into the specified node.

Link copied to clipboard
fun setEndAfter(node: Node)

The Range.setEndAfter() method sets the end position of a Node of end of the Range will be the same as that for the referenceNode.

Link copied to clipboard
fun setEndBefore(node: Node)

The Range.setEndBefore() method sets the end position of a Range relative to another Node.

Link copied to clipboard
fun setStart(node: Node, offset: Int)

The Range.setStart() method sets the start position of a If the startNode is a Node of type Text, the number of characters from the start of startNode.

Link copied to clipboard
fun setStartAfter(node: Node)

The Range.setStartAfter() method sets the start position of a Range relative to a Node.

Link copied to clipboard
fun setStartBefore(node: Node)

The Range.setStartBefore() method sets the start position of a Range relative to another Node.

Link copied to clipboard
fun surroundContents(newParent: Node)

The surroundContents() method of the Range interface surrounds the selected content by a provided node.