Export (0) Print
Expand All

compareEndPoints method

Compares an end point of a TextRange object with an end point of another range.

Syntax

var retval = TextRange.compareEndPoints(how, SourceRange);

Parameters

how [in]

Type: String

String that specifies one of the following values:

StartToEnd

Compare the start of the TextRange object with the end of the SourceRange parameter.

StartToStart

Compare the start of the TextRange object with the start of the SourceRange parameter.

EndToStart

Compare the end of the TextRange object with the start of the SourceRange parameter.

EndToEnd

Compare the end of the TextRange object with the end of the SourceRange parameter.

SourceRange [in]

Type: IHTMLTxtRange

TextRange object that specifies the range to compare with the object.

Return value

Type: Integer

Integer. Returns one of the following possible values:
Return valueDescription
-1

The end point of the object is further to the left than the end point of SourceRange.

0

The end point of the object is at the same location as the end point of SourceRange.

1

The end point of the object is further to the right than the end point of SourceRange.

 

Standards information

There are no standards that apply here.

Remarks

A text range has two end points. One end point is located at the beginning of the text range, and the other is located at the end of the text range. An end point also can be characterized as the position between two characters in an HTML document.

There are four possible end points in the following HTML:


<body><p><strong>abc

The possible end points are:

  • Before the letter a.
  • Between the letters a and b.
  • Between the letters b and c.
  • After the letter c.

An end point cannot be established between the body and the p. Such an end point is considered to be located before the letter a.

This method might not be available on non-Microsoft Win32 platforms.

As of Microsoft Internet Explorer 4.0, an end point is relative to text only, not HTML tags.

See also

TextRange
setEndPoint

 

 

Show:
© 2014 Microsoft