class Range extends Object
The Range interface represents a fragment of a document that can contain nodes and parts of text nodes in a given document.
A range can be created using the createRange method of the Document object. Range objects can also be retrieved by using the getRangeAt method of the Selection object. There also is the Range() constructor available.
MDN
- Annotations
- @JSType() @native() @JSGlobal()
- Alphabetic
- By Inheritance
- Range
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Range()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
cloneContents(): DocumentFragment
The Range.cloneContents() returns a DocumentFragment copying the objects of type Node included in the Range.
The Range.cloneContents() returns a DocumentFragment copying the objects of type Node included in the Range.
MDN
-
def
cloneRange(): Range
The Range.cloneRange() method returns a Range object with boundary points identical to the cloned Range.
The Range.cloneRange() method returns a Range object with boundary points identical to the cloned Range.
MDN
-
def
collapse(toStart: Boolean): Unit
The Range.collapse() method collapses the Range to one of its boundary points.
The Range.collapse() method collapses the Range to one of its boundary points.
MDN
-
def
collapsed: Boolean
The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the Range are at the same position.
The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the Range are at the same position. It returns true if the start and end boundary points of the Range are the same point in the DOM, false if not.
MDN
-
def
commonAncestorContainer: Node
The Range.commonAncestorContainer read-only property returns the deepest, or further down the document tree, Node that contains both the Range.startContainer and Range.endContainer nodes.
The Range.commonAncestorContainer read-only property returns the deepest, or further down the document tree, Node that contains both the Range.startContainer and Range.endContainer nodes.
MDN
-
def
compareBoundaryPoints(how: Int, sourceRange: Range): Int
The Range.compareBoundaryPoints() method compares the boundary points of the Range with another one.
The Range.compareBoundaryPoints() method compares the boundary points of the Range with another one.
MDN
-
def
createContextualFragment(fragment: String): DocumentFragment
The Range.createContextualFragment() method returns a DocumentFragment by invoking the HTML fragment parsing algorithm or the XML fragment parsing algorithm with the start of the range (the parent of the selected node) as the context node.
The Range.createContextualFragment() method returns a DocumentFragment by invoking the HTML fragment parsing algorithm or the XML fragment parsing algorithm with the start of the range (the parent of the selected node) as the context node. The HTML fragment parsing algorithm is used if the range belongs to a Document whose HTMLness bit is set. In the HTML case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead.
MDN
-
def
deleteContents(): Unit
The Range.deleteContents() removes the contents of the Range from the Document.
The Range.deleteContents() removes the contents of the Range from the Document.
MDN
-
def
detach(): Unit
The Range.detach() method releases a Range from use.
The Range.detach() method releases a Range from use. This lets the browser choose to release resources associated with this Range. Subsequent attempts to use the detached range will result in a DOMException being thrown with an error code of INVALID_STATE_ERR.
MDN
-
def
endContainer: Node
The Range.endContainer read-only property returns the Node within which the Range ends.
The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position of a node, use the Range.setEnd() method or a similar one.
MDN
-
def
endOffset: Int
The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range ends.
The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range ends.
MDN
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
extractContents(): DocumentFragment
The Range.extractContents() method moves contents of the Range from the document tree into a DocumentFragment.
The Range.extractContents() method moves contents of the Range from the document tree into a DocumentFragment.
MDN
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getBoundingClientRect(): ClientRect
The Range.getBoundingClientRect() method returns a ClientRect object that bounds the contents of the range; this a rectangle enclosing the union of the bounding rectangles for all the elements in the range.
The Range.getBoundingClientRect() method returns a ClientRect object that bounds the contents of the range; this a rectangle enclosing the union of the bounding rectangles for all the elements in the range.
MDN
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getClientRects(): ClientRectList
The Range.getClientRects() method returns a list of ClientRect objects representing the area of the screen occupied by the range.
The Range.getClientRects() method returns a list of ClientRect objects representing the area of the screen occupied by the range. This is created by aggregating the results of calls to Element.getClientRects() for all the elements in the range.
MDN
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
insertNode(newNode: Node): Unit
The Range.insertNode() method inserts a node at the start of the Range.
The Range.insertNode() method inserts a node at the start of the Range.
MDN
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
selectNode(refNode: Node): Unit
The Range.selectNode() method sets the Range to contain the Node and its contents.
The Range.selectNode() method sets the Range to contain the Node and its contents. The parent Node of the start and end of the Range will be the same as the parent of the referenceNode.
MDN
-
def
selectNodeContents(refNode: Node): Unit
The Range.selectNodeContents() sets the Range to contain the contents of a Node.
The Range.selectNodeContents() sets the Range to contain the contents of a Node.
MDN
-
def
setEnd(refNode: Node, offset: Int): Unit
The Range.setEnd() method sets the end position of a Range.
The Range.setEnd() method sets the end position of a Range.
MDN
-
def
setEndAfter(refNode: Node): Unit
The Range.setEndAfter() method sets the end position of a Range relative to another Node.
The Range.setEndAfter() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode.
MDN
-
def
setEndBefore(refNode: Node): Unit
The Range.setEndBefore() method sets the end position of a Range relative to another Node.
The Range.setEndBefore() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode.
MDN
-
def
setStart(refNode: Node, offset: Int): Unit
The Range.setStart() method sets the start position of a Range.
The Range.setStart() method sets the start position of a Range.
MDN
-
def
setStartAfter(refNode: Node): Unit
The Range.setStartAfter() method sets the start position of a Range relative to a Node.
The Range.setStartAfter() method sets the start position of a Range relative to a Node. The parent Node of the start of the Range will be the same as that for the referenceNode.
MDN
-
def
setStartBefore(refNode: Node): Unit
The Range.setStartBefore() method sets the start position of a Range relative to another Node.
The Range.setStartBefore() method sets the start position of a Range relative to another Node. The parent Node of the start of the Range will be the same as that for the referenceNode.
MDN
-
def
startContainer: Node
The Range.startContainer read-only property returns the Node within which the Range starts.
The Range.startContainer read-only property returns the Node within which the Range starts. To change the start position of a node, use one of the Range.setStart() methods.
MDN
-
def
startOffset: Int
The Range.startOffset read-only property returns a number representing where in the startContainer the Range starts.
The Range.startOffset read-only property returns a number representing where in the startContainer the Range starts.
MDN
-
def
surroundContents(newParent: Node): Unit
The Range.surroundContents() method moves content of the Range into a new node, placing the new node at the start of the specified range.
The Range.surroundContents() method moves content of the Range into a new node, placing the new node at the start of the specified range.
MDN
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()