klyn.io.xml.dom.XMLNode.compareDocumentPosition
method
public compareDocumentPosition(other as Node) as Int throws DOMException:
Description

Compares positions in a tree using node identity, not structural equality.

Parameters
ParameterDescription
otherNode to locate relative to this node.
Returns

Bitmask of DOCUMENT_POSITION flags; zero for the same node.

Throws
  • DOMException if the DOM operation violates document ownership, hierarchy, naming, index, or node-state constraints.
Example
position = root.compareDocumentPosition(root.firstChild)
assert (position & Node.DOCUMENT_POSITION_FOLLOWING) != 0