Programmer's Guide > Interfaces > W3C Node interface > compareDocumentPosition method
  
compareDocumentPosition method
Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to the document order.
compareDocumentPosition(other )
Parameters
Nodeother
The node to compare against the reference node.
Returns
unsigned short. Returns how the node is positioned relatively to the reference node.
Throws
DOMException
NOT_SUPPORTED_ERR: when the compared nodes are from different DOM implementations that do not coordinate to return consistent implementation-specific results.