1--TEST-- 2compareDocumentPosition: contains attribute as a descendent in a longer path 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = new DOMDocument(); 9$dom->loadXML(<<<XML 10<?xml version="1.0"?> 11<container> 12 <div> 13 <p align="center"/> 14 </div> 15</container> 16XML); 17 18$container = $dom->documentElement; 19$p = $container->firstElementChild->firstElementChild; 20$attribute = $p->attributes[0]; 21 22var_dump($container->compareDocumentPosition($attribute) === (DOMNode::DOCUMENT_POSITION_FOLLOWING | DOMNode::DOCUMENT_POSITION_CONTAINED_BY)); 23var_dump($attribute->compareDocumentPosition($container) === (DOMNode::DOCUMENT_POSITION_PRECEDING | DOMNode::DOCUMENT_POSITION_CONTAINS)); 24 25?> 26--EXPECT-- 27bool(true) 28bool(true) 29