Node.compareDocumentPosition()
Compares the relative position of two nodes to each other in the DOM tree.
IE | Edge | Firefox | Chrome | Safari | Opera | iOS Safari | Opera Mini | Android Browser | Blackberry Browser | Opera Mobile | Chrome for Android | Firefox for Android | IE Mobile | UC Browser for Android | Samsung Internet | QQ Browser | Baidu Browser |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
49 | |||||||||||||||||
56 | 9.3
See notes:
|
4.4 | |||||||||||||||
14 | 52 | 57 | 10 | 10.0-10.2 | 4.4.3-4.4.4 | 4 | |||||||||||
11 | 15 | 53 | 58 | 10.1 | 44 | 10.3 | all | 56 | 10
See notes:
|
37 | 57 | 52 | 11 | 11.4 | 5 | 1.2 | 7.12 |
54 | 59 | TP | 45 | ||||||||||||||
55 | 60 | 46 | |||||||||||||||
56 | 61 |
Notes
-
1
The spec requires that comparisons of nodes in different documents, and comparisons where at least one node is not in any document, must arbitrarily (but consistently) set either the
DOCUMENT_POSITION_PRECEDING
orDOCUMENT_POSITION_FOLLOWING
bit in the result. These browser versions don't set either bit in some such cases. -
2
Sets neither the
DOCUMENT_POSITION_DISCONNECTED
bit nor theDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
bit in some cases when comparing nodes in different documents or when comparing a node which is not in any document.