Javascript Reference
Categories: TextRange

javascript TextRange compareEndPoints( )

@March 15, 2008, 1:22 a.m.
compareEndPoints( )Firefox/Netscape/NN n/a IE 4(Win) Chrome/Safari/DOM n/a  

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.

 
Parameters
 
  • One of the following constants (as a string): StartToEnd | StartToStart | EndToStart | EndToEnd.
  • A TextRange object created earlier and saved to a variable.
 
Returned Value

-1, 0, or 1.


Powered by Linode.