compareNode method (Range)
Returns an integer that represents whether the specified node is before, inside, after, or surrounding the current Range object.
Note: the support for the compareNode method has been removed in Firefox 3. Use the compareBoundaryPoints method instead.
You can find the related objects in the Supported by objects section below.
|Required. Reference to the node to compare.|
Integer that retrieves the placement of the node relative to the current Range object in the DOM hierarchy.
Predefined constants are available for the possible returned values, in the scope of the Range object. For further details, see the page for the Range object.
The value can be one of the following values (the value of a predefined constant appears in parentheses after the constant):
|The node is before the current Range object.|
|The node is after the current Range object.|
|The node is surrounding the current Range object.|
|The node is inside the current Range object.|
Example HTML code 1:
This example illustrates the use of the compareNode method:
Did you find this example helpful?
User Contributed Comments