short compareBoundaryPoints(unsigned short how, Range sourceRange) throws DOMException;
how
Specifies how to perform the comparison (i.e., which boundary points to compare). Legal values are the constants defined by the Range interface.
sourceRange
The range that is to be compared to this range.
-1 if the specified boundary point of this range is before the specified boundary point of sourceRange, 0 if the two specified boundary points are the same, or 1 if the specified boundary point of this range is after the specified boundary point of sourceRange.
If sourceRange represents a range of a different document than this range does, this method throws a DOMException with a code of WRONG_DOCUMENT_ERR.
This method compares a boundary point of this range to a boundary point of the specified sourceRange and returns a value that specifies their relative order in the document source. The how argument specifies which boundary points of each range are to be compared. The legal values for this argument, and their meanings, are as follows:
Range.START_TO_START
Compare the start points of the two Range nodes.
Range.END_TO_END
Compare the end points of the two Range nodes.
Range.START_TO_END
Compare the start point of sourceRange to the end point of this range.
Range.END_TO_START
Compare the end point of sourceRange to the start point of this range.
The return value of this method is a number that specifies the relative position of this range to the specified sourceRange. Therefore, you might expect the range constants for the how argument to specify the boundary point for this range first and the boundary point for sourceRange second. Counterintuitively, however, the Range.START_TO_END constant specifies a comparison of the
end point of this range with the
start point of the specified sourceRange. Similarly, the Range.END_TO_START constant specifies a comparison of the
start point of this range with the
end point of the specified range.