Name
compareEndPoints( ) — NN n/a IE 4 DOM n/a
Synopsis
compareEndPoints(type,
comparisonRange)
Compares the relative position of the boundary (start and end) points
of two ranges (the current range and one that had been previously
saved to a variable). The first parameter defines which boundary
points in each range you wish to compare. If the result of the
comparison is that the first point is earlier in the range than the
other point, the returned value is -1; if the result shows both
points to be in the same location, the returned value is 0; if the
result shows the first point to be later in the range than the other
point, the returned value is 1. For example, if you have saved the
first range to a variable r1 and created a new
range as r2, you can see the physical relationship
between the end of r2 and the start of
r1:
r1.compareEndPoints("EndToStart", r2)If r1 ends where r2 starts (the
insertion point between two characters), the returned value is 0.
Returned Value
-1, 0, or 1.
Parameters
-
type One of the following constants (as a string):
StartToEnd|StartToStart|EndToStart|EndToEnd.-
comparisonRange A
TextRangeobject created earlier and saved to a variable.
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