Skip to Main Content
JavaScript: The Definitive Guide, Fourth Edition
book

JavaScript: The Definitive Guide, Fourth Edition

by David Flanagan
November 2001
Intermediate to advanced content levelIntermediate to advanced
936 pages
68h 43m
English
O'Reilly Media, Inc.
Content preview from JavaScript: The Definitive Guide, Fourth Edition

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

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 ...

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.
Start your free trial

You might also like

JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition

JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition

John Pollock
Coding with JavaScript For Dummies

Coding with JavaScript For Dummies

Chris Minnick, Eva Holland

Publisher Resources

ISBN: 0596000480Supplemental ContentCatalog PageErrata