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