1--TEST-- 2compareDocumentPosition: contains attribute for a freestanding element 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = new DOMDocument(); 9$foo = $dom->createElement("foo"); 10$foo->setAttribute("test", "value"); 11$attribute = $foo->attributes[0]; 12 13echo $dom->saveXML($foo), "\n"; 14 15var_dump($foo->compareDocumentPosition($attribute) === (DOMNode::DOCUMENT_POSITION_FOLLOWING | DOMNode::DOCUMENT_POSITION_CONTAINED_BY)); 16var_dump($attribute->compareDocumentPosition($foo) === (DOMNode::DOCUMENT_POSITION_PRECEDING | DOMNode::DOCUMENT_POSITION_CONTAINS)); 17 18?> 19--EXPECT-- 20<foo test="value"/> 21bool(true) 22bool(true) 23