Ranges

Modern word processors allow a range of text to be selected by clicking the mouse at the start-point, and dragging across and down to the end-point, leaving the selected area highlighted to show its scope. After selection, the user can select 'delete' or 'copy' from a menu. This concept can also be applied to DOM trees. The new Ranges module of the DOM standard provides a standard way to define and modify a range of data that may include nodes of various types, including text and element nodes.

Parser support

The hasFeature method can be used to discover whether or not a parser supports this module:

if ( myDOM.hasFeature("Range", "2.0") == true )
{
  // Ranges are supported
}

Range scope

A range is defined by a start-point and an end-point. ...

Get XML Companion, The, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.