diff --git a/reference/dom/domnode.xml b/reference/dom/domnode.xml index f71796fc1413..b83ab6a33972 100644 --- a/reference/dom/domnode.xml +++ b/reference/dom/domnode.xml @@ -24,6 +24,50 @@ DOMNode + &Constants; + + public + const + int + DOMNode::DOCUMENT_POSITION_DISCONNECTED + 1 + + + public + const + int + DOMNode::DOCUMENT_POSITION_PRECEDING + 2 + + + public + const + int + DOMNode::DOCUMENT_POSITION_FOLLOWING + 4 + + + public + const + int + DOMNode::DOCUMENT_POSITION_CONTAINS + 8 + + + public + const + int + DOMNode::DOCUMENT_POSITION_CONTAINED_BY + 16 + + + public + const + int + DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + 32 + + &Properties; public @@ -139,7 +183,75 @@ - + +
+ &reftitle.constants; + + + + DOMNode::DOCUMENT_POSITION_DISCONNECTED + + + + Set when the other node and reference node are not in the same tree. + + + + + + DOMNode::DOCUMENT_POSITION_PRECEDING + + + + Set when the other node precedes the reference node. + + + + + + DOMNode::DOCUMENT_POSITION_FOLLOWING + + + + Set when the other node follows the reference node. + + + + + + DOMNode::DOCUMENT_POSITION_CONTAINS + + + + Set when the other node is an ancestor of the reference node. + + + + + + DOMNode::DOCUMENT_POSITION_CONTAINED_BY + + + + Set when the other node is a descendant of the reference node. + + + + + + DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + + + + Set when the result depends on implementation-specific behaviour and + may not be portable. + This may happen with disconnected nodes or with attribute nodes. + + + + +
+
&reftitle.properties; diff --git a/reference/dom/domnode/compareDocumentPosition.xml b/reference/dom/domnode/compareDocumentPosition.xml new file mode 100644 index 000000000000..00e286d8f5f1 --- /dev/null +++ b/reference/dom/domnode/compareDocumentPosition.xml @@ -0,0 +1,96 @@ + + + + DOMNode::compareDocumentPosition + Compares the position of two nodes + + + + &reftitle.description; + + public intDOMNode::compareDocumentPosition + DOMNodeother + + + Compares the position of the other node relative to this node. + + + + + &reftitle.parameters; + + + other + + + The node for which the position should be compared for, relative to this node. + + + + + + + + &reftitle.returnvalues; + + A bitmask of the DOMNode::DOCUMENT_POSITION_* + constants. + + + + + &reftitle.examples; + + <methodname>DOMNode::compareDocumentPosition</methodname> example + + + + + +XML; + +$dom = new DOMDocument(); +$dom->loadXML($xml); + +$root = $dom->documentElement; +$child1 = $root->firstElementChild; +$child2 = $child1->nextElementSibling; + +var_dump($root->compareDocumentPosition($child1)); +var_dump($child2->compareDocumentPosition($child1)); +?> +]]> + + &example.outputs; + + + + + + + diff --git a/reference/dom/versions.xml b/reference/dom/versions.xml index dca0ded27422..6244affd03ec 100644 --- a/reference/dom/versions.xml +++ b/reference/dom/versions.xml @@ -145,7 +145,7 @@ - +