Visit Mozilla.org

DOM:range.comparePoint

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the range.

[edit] Syntax

returnValue = range.comparePoint( referenceNode, offset )

[edit] Parameters

referenceNode 
The Node to compare with the Range.
offset 
An integer greater than or equal to zero representing the offset inside the referenceNode.

[edit] Example

range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
returnValue = range.comparePoint(document.getElementsByTagName("p").item(0),1);

[edit] Notes

If the referenceNode is a Node of type Text, Comment, or CDATASection, then offset is the number of characters from the start of referenceNode. For other Node types, offset is the number of child nodes between the start of the referenceNode.

[edit] Specification

This method is not part of a specification.