Range extension type
The Range interface represents a fragment of a document that can
contain nodes and parts of text nodes.
A range can be created by using the Document.createRange method. Range
objects can also be retrieved by using the Selection.getRangeAt method of
the Selection object or the Document.caretRangeFromPoint method of the
Document object.
There also is the Range.Range constructor available.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Constructors
- Range()
-
factory
Properties
- asString → String
-
Available on JSAny, provided by the JSAnyExtension extension
no setter - asString → String?
-
Available on JSAny?, provided by the JSAnyNullableExtension extension
no setter - collapsed → bool
-
The read-only
collapsedproperty of the AbstractRange interface returnstrueif the range's start position and end position are the same.no setterinherited - commonAncestorContainer → Node
-
The
Range.commonAncestorContainerread-only property returns the deepest — or furthest down the document tree — Node that contains both boundary points of the Range. This means that if Range.startContainer and Range.endContainer both refer to the same node, this node is the common ancestor container.no setter - endContainer → Node
-
The read-only
endContainerproperty of the AbstractRange interface returns the Node in which the end of the range is located.no setterinherited - endOffset → int
-
The
endOffsetproperty of the AbstractRange interface returns the offset into the end node of the range's end position.no setterinherited -
entries
→ Iterable<
MapEntry< String, dynamic> > -
Available on JSObject, provided by the JSObjectExtension extension
no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isDefinedAndNotNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - isElement → bool
-
Available on JSObject?, provided by the JSObjectWebExtension extension
no setter - isHTMLElement → bool
-
Available on JSObject?, provided by the JSObjectWebExtension extension
no setter - isNode → bool
-
Available on JSObject?, provided by the JSObjectWebExtension extension
no setter - isNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptnull.no setter - isTruthy → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!!in JavaScript.thisno setter - isUndefined → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptundefined.no setter - isUndefinedOrNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter -
keys
→ Iterable<
String> -
Available on JSObject, provided by the JSObjectExtension extension
no setter - not → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!in JavaScript.thisno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startContainer → Node
-
The read-only
startContainerproperty of the AbstractRange interface returns the start Node for the range.no setterinherited - startOffset → int
-
The read-only
startOffsetproperty of the AbstractRange interface returns the offset into the start node of the range's start position.no setterinherited
Methods
-
add(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this+any -
and(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this&&any -
as<
T extends JSObject> () → T? -
Available on JSObject, provided by the JSObjectExtension extension
-
callMethod<
R extends JSAny?> (JSAny method, [JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethodon this JSObject with up to four arguments. -
callMethodVarArgs<
R extends JSAny?> (JSAny method, [List< JSAny?> ? arguments]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethodon this JSObject with a variable number ofarguments. -
cloneContents(
) → DocumentFragment -
The
Range.cloneContents()returns a DocumentFragment copying the objects of type Node included in the Range. -
cloneRange(
) → Range -
The
Range.cloneRange()method returns a Range object with boundary points identical to the cloned Range. -
collapse(
[bool toStart]) → void -
The
Range.collapse()method collapses the Range to one of its boundary points. -
compareBoundaryPoints(
int how, Range sourceRange) → int -
The
Range.compareBoundaryPoints()method compares the boundary points of the Range with those of another range. -
comparePoint(
Node node, int offset) → int -
The
Range.comparePoint()method returns-1,0, or1depending on whether thereferenceNodeis before, the same as, or after the Range. -
createContextualFragment(
JSAny 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 HTML fragment parsing algorithm is used if the range belongs to aDocumentwhose HTMLness bit is set. In the HTML case, if the context node would behtml, for historical reasons the fragment parsing algorithm is invoked withbodyas the context instead. -
dartify(
) → Object? -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Converts a JavaScript JSON-like value to the Dart equivalent if possible. -
delete(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Deletes the property with keypropertyfrom this JSObject. -
deleteContents(
) → void -
The
Range.deleteContents()method removes the contents of the Range from the Document. -
detach(
) → void -
The
Range.detach()method does nothing. It used to disable the Range object and enable the browser to release associated resources. The method has been kept for compatibility. -
divide(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this/any -
equals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this==any -
exponentiate(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this**any -
extractContents(
) → DocumentFragment -
The
Range.extractContents()method moves contents of the Range from the document tree into a DocumentFragment. -
get(
String key) → Object? -
Available on JSObject, provided by the JSObjectExtension extension
-
getBoundingClientRect(
) → DOMRect -
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. -
getClientRects(
) → DOMRectList -
The
Range.getClientRects()method returns a list of DOMRect 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. -
getProperty<
R extends JSAny?> (JSAny property) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
The value of the property keypropertyof this JSObject. -
greaterThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this>any -
greaterThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this>=any -
has(
String property) → bool -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for hasProperty to check whether this JSObject contains the property keyproperty, but takes and returns a Dart value. -
hasProperty(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Whether or not this JSObject contains the property keyproperty. -
insertNode(
Node node) → void -
The
Range.insertNode()method inserts a node at the start of the Range. -
instanceof(
JSFunction constructor) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?is aninstanceofconstructor. -
instanceOfString(
String constructorName) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?is aninstanceofthe constructor that is defined byconstructorName, which is looked up in the globalContext. -
intersectsNode(
Node node) → bool -
The
Range.intersectsNode()method returns a boolean indicating whether the given Node intersects the Range. -
isA<
T extends JSAny?> () → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?is an instance of the JavaScript type that is declared byT. -
isPointInRange(
Node node, int offset) → bool -
The
Range.isPointInRange()method returns a boolean indicating whether the given point is in the Range. It returnstrueif the point (cursor position) atoffsetwithinReferenceNodeis within this range. -
lessThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this<any -
lessThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this<=any -
modulo(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this%any -
multiply(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this*any -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this!=any -
or(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this||any -
put(
Object key, Object? value) → void -
Available on JSObject, provided by the JSObjectExtension extension
-
selectNode(
Node node) → void -
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. -
selectNodeContents(
Node node) → void -
The
Range.selectNodeContents()method sets the Range to contain the contents of a Node. -
setEnd(
Node node, int offset) → void -
The
Range.setEnd()method sets the end position of a Range to be located at the given offset into the specified node x.Setting the end point above (higher in the document) than the start point will result in a collapsed range with the start and end points both set to the specified end position. -
setEndAfter(
Node node) → void -
The
Range.setEndAfter()method sets the end position of a Range relative to another Node. The parentNodeof end of theRangewill be the same as that for thereferenceNode. -
setEndBefore(
Node node) → void -
The
Range.setEndBefore()method sets the end position of aRangerelative to another Node. The parentNodeof end of theRangewill be the same as that for thereferenceNode. -
setProperty(
JSAny property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Write thevalueof property keypropertyof this JSObject. -
setStart(
Node node, int offset) → void -
The
Range.setStart()method sets the start position of a Range. -
setStartAfter(
Node node) → void -
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 thereferenceNode. -
setStartBefore(
Node node) → void -
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 thereferenceNode. -
strictEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this===any -
strictNotEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this!==any -
subtract(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this-any -
surroundContents(
Node newParent) → void -
The
Range.surroundContents()method moves content of the Range into a new node, placing the new node at the start of the specified range. -
toMap(
) → Map< String, dynamic> -
Available on JSObject, provided by the JSObjectExtension extension
-
toString(
) → String -
A string representation of this object.
inherited
-
typeofEquals(
String typeString) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether the result oftypeofon thisJSAny?istypeString. -
unsignedRightShift(
JSAny? any) → JSNumber -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this>>>any
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String property) → JSAny? -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for getProperty to get the value of the property keypropertyof this JSObject, but takes a Dart value. -
operator []=(
String property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for setProperty to write thevalueof the property keypropertyof this JSObject, but takes a Dart value.
Constants
- END_TO_END → const int
- END_TO_START → const int
- START_TO_END → const int
- START_TO_START → const int