HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

compareDocumentPosition

Description

The compareDocumentPosition of Node for JS returns a bitmask indicating the position of other relative to node.

NameNumberDescription
Node.DOCUMENT_POSITION_DISCONNECTED1Other is not in the same tree as node
Node.DOCUMENT_POSITION_PRECEDING2Other precedes node
Node.DOCUMENT_POSITION_FOLLOWING4Other follows node
Node.DOCUMENT_POSITION_CONTAINS8Other is an ancestor of node
Node.DOCUMENT_POSITION_CONTAINED_BY16 (10 in hexadecimal)Other is a descendant of node
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC32 (20 in hexadecimal)Other is implementation-specific relative to node

Syntax

node.compareDocumentPosition(other)

Parameters

other

A node.

Examples

1

2

3

4

5

6