Dart API Referencedart:htmlRange

Range Interface

The Range object 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 Document.createRange  method of the Document  object. Range objects can also be retrieved by using the Selection.getRangeAt  method of the Selection  object.

Static Fields

Code final int END_TO_END #

static final int END_TO_END = 2;

Code final int END_TO_START #

static final int END_TO_START = 3;

Code final int NODE_AFTER #

static final int NODE_AFTER = 1;

Code final int NODE_BEFORE #

static final int NODE_BEFORE = 0;

Code final int NODE_BEFORE_AND_AFTER #

static final int NODE_BEFORE_AND_AFTER = 2;

Code final int NODE_INSIDE #

static final int NODE_INSIDE = 3;

Code final int START_TO_END #

static final int START_TO_END = 1;

Code final int START_TO_START #

static final int START_TO_START = 0;

Methods

Code DocumentFragment cloneContents() #

Returns a DocumentFragment  copying the nodes of a Range.
DocumentFragment cloneContents();

Code Range cloneRange() #

Returns a Range object with boundary points identical to the cloned Range.
Range cloneRange();

Code void collapse(bool toStart) #

Collapses the Range to one of its boundary points.
void collapse(bool toStart);

Code int compareNode(Node refNode) #

Returns a constant representing whether the Node is before, after, inside, or surrounding the range.
int compareNode(Node refNode);

Code int comparePoint(Node refNode, int offset) #

Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the range.
int comparePoint(Node refNode, int offset);

Code DocumentFragment createContextualFragment(String html) #

Returns a DocumentFragment  created from a given string of code.
DocumentFragment createContextualFragment(String html);

Code void deleteContents() #

Removes the contents of a Range from the Document .
void deleteContents();

Code void detach() #

Releases Range from use to improve performance.
void detach();

Code void expand(String unit) #

void expand(String unit);

Code DocumentFragment extractContents() #

Moves contents of a Range from the document tree into a DocumentFragment .
DocumentFragment extractContents();

Code ClientRect getBoundingClientRect() #

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

Code ClientRectList getClientRects() #

Returns a list of ClientRect objects that aggregates the results of Element.getClientRects() for all the elements in the range.
ClientRectList getClientRects();

Code void insertNode(Node newNode) #

Insert a Node  at the start of a Range.
void insertNode(Node newNode);

Code bool intersectsNode(Node refNode) #

Returns a boolean indicating whether the given node intersects the range.
bool intersectsNode(Node refNode);

Code bool isPointInRange(Node refNode, int offset) #

Returns a boolean indicating whether the given point is in the range.
bool isPointInRange(Node refNode, int offset);

Code void selectNode(Node refNode) #

Sets the Range to contain the Node  and its contents.
void selectNode(Node refNode);

Code void selectNodeContents(Node refNode) #

Sets the Range to contain the contents of a Node .
void selectNodeContents(Node refNode);

Code void setEnd(Node refNode, int offset) #

Sets the end position of a Range.
void setEnd(Node refNode, int offset);

Code void setEndAfter(Node refNode) #

Sets the end position of a Range relative to another Node .
void setEndAfter(Node refNode);

Code void setEndBefore(Node refNode) #

Sets the end position of a Range relative to another Node .
void setEndBefore(Node refNode);

Code void setStart(Node refNode, int offset) #

Sets the start position of a Range.
void setStart(Node refNode, int offset);

Code void setStartAfter(Node refNode) #

Sets the start position of a Range relative to another Node .
void setStartAfter(Node refNode);

Code void setStartBefore(Node refNode) #

Sets the start position of a Range relative to another Node .
void setStartBefore(Node refNode);

Code void surroundContents(Node newParent) #

Moves content of a Range into a new Node .
void surroundContents(Node newParent);

Code String toString() #

Returns the text of the Range
String toString();

Fields

Code final bool collapsed #

Returns a boolean indicating whether the range's start and end points are at the same position.
final bool collapsed;

Code final Node commonAncestorContainer #

Returns the deepest Node  that contains the startContainer and endContainer Nodes.
final Node commonAncestorContainer;

Code final Node endContainer #

Returns the Node  within which the Range ends.
final Node endContainer;

Code final int endOffset #

Returns a number representing where in the endContainer the Range ends.
final int endOffset;

Code final Node startContainer #

Returns the Node  within which the Range starts.
final Node startContainer;

Code final int startOffset #

Returns a number representing where in the startContainer the Range starts.
final int startOffset;

This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.