Name
Range — represents a contiguous range of a document
Availability
DOM Level 2 Range
Constants
These constants specify how the boundary points of two Range objects
are to be 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 Compare the start of the specified range to the start of this range.
-
unsigned short START_TO_END = 1 Compare the start of the specified range to the end of this range.
-
unsigned short END_TO_END = 2 Compare the end of the specified range to the end of this range.
-
unsigned short END_TO_START = 3 Compare 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 trueif 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.”-
readonlyNodecommonAncestorContainer The most deeply nested Document node that contains (i.e., is an ancestor of ) both the start and end points of the range.
-
readonlyNodeendContainer The Document ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access