Name
Range: represents a contiguous range of a document — DOM Level 2 Range: Object → Range
Constants
These constants specify how the boundary points of two Range
objects are compared. They are the legal values for the
how
argument to the compareBoundaryPoints( )
method (see the
Range.compareBoundaryPoints( )
reference page):
-
unsigned short START_TO_START = 0
Compares the start of the specified range to the start of this range.
-
unsigned short START_TO_END = 1
Compares the start of the specified range to the end of this range.
-
unsigned short END_TO_END = 2
Compares the end of the specified range to the end of this range.
-
unsigned short END_TO_START = 3
Compares the end of the specified range to the start of this range.
Properties
The Range interface defines the following properties. Note that all of
these properties are read-only. You cannot change the start or end
points of a range by setting properties; you must call setEnd( )
or setStart( )
instead. Note also that after
you call the detach( )
method of
a Range object, any subsequent attempt to read any of these
properties throws a DOMException with a code
of INVALID_STATE_ERR
:
-
readonly boolean collapsed
true
if the start and the end of the range are at the same point in the document—that is, if the range is empty or “collapsed.”-
readonly Node commonAncestorContainer
The most deeply nested Document node that contains (i.e., is an ancestor of) both the start and end points of the range.
-
readonly Node endContainer
The Document node that ...
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.