1--TEST--
2Attribute entity expansion
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$doc = Dom\HTMLDocument::createEmpty();
8$elt = $doc->createElement('elt');
9$doc->appendChild($elt);
10$elt->setAttribute('a','&');
11print $doc->saveHtml($elt) . "\n";
12
13$attr = $elt->getAttributeNode('a');
14$attr->value = '&amp;';
15print "$attr->value\n";
16print $doc->saveHtml($elt) . "\n";
17
18$attr->removeChild($attr->firstChild);
19print $doc->saveHtml($elt) . "\n";
20
21$attr->nodeValue = '&';
22print "$attr->nodeValue\n";
23print $doc->saveHtml($elt) . "\n";
24
25$attr->nodeValue = '&amp;';
26print "$attr->nodeValue\n";
27print $doc->saveHtml($elt) . "\n";
28
29$elt->removeAttributeNode($attr);
30$elt->setAttributeNS('http://www.w3.org/2000/svg', 'svg:id','&amp;');
31print $doc->saveHtml($elt) . "\n";
32
33$attr = $elt->getAttributeNodeNS('http://www.w3.org/2000/svg', 'id');
34$attr->value = '&lt;&amp;';
35print "$attr->value\n";
36print $doc->saveHtml($elt) . "\n";
37?>
38--EXPECT--
39<elt a="&amp;"></elt>
40&amp;
41<elt a="&amp;amp;"></elt>
42<elt a=""></elt>
43&
44<elt a="&amp;"></elt>
45&amp;
46<elt a="&amp;amp;"></elt>
47<elt svg:id="&amp;amp;"></elt>
48&lt;&amp;
49<elt svg:id="&amp;lt;&amp;amp;"></elt>
50