1--TEST--
2Dom\HTMLDocument serialization of void elements
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = Dom\HTMLDocument::createEmpty();
9$container = $dom->createElement("container");
10$dom->append($container);
11
12$tags = [
13    "area",
14    "base",
15    "br",
16    "col",
17    "embed",
18    "hr",
19    "img",
20    "input",
21    "link",
22    "meta",
23    "source",
24    "track",
25    "wbr",
26    "basefont",
27    "bgsound",
28    "frame",
29    "keygen",
30    "param",
31];
32
33foreach ($tags as $tag) {
34    $element = $container->appendChild($dom->createElement($tag));
35    $element->appendChild($dom->createElement("inner"));
36    $element->after("\n");
37    echo "$tag: ";
38    var_dump($dom->saveHtml($element));
39
40    $element = $container->appendChild($dom->createElementNS("http://php.net/foo", "x:$tag"));
41    $element->appendChild($dom->createElement("inner"));
42    $element->after("\n");
43}
44
45echo $dom->saveHtml();
46
47?>
48--EXPECT--
49area: string(6) "<area>"
50base: string(6) "<base>"
51br: string(4) "<br>"
52col: string(5) "<col>"
53embed: string(7) "<embed>"
54hr: string(4) "<hr>"
55img: string(5) "<img>"
56input: string(7) "<input>"
57link: string(6) "<link>"
58meta: string(6) "<meta>"
59source: string(8) "<source>"
60track: string(7) "<track>"
61wbr: string(5) "<wbr>"
62basefont: string(10) "<basefont>"
63bgsound: string(9) "<bgsound>"
64frame: string(7) "<frame>"
65keygen: string(8) "<keygen>"
66param: string(7) "<param>"
67<container><area>
68<x:area><inner></inner></x:area>
69<base>
70<x:base><inner></inner></x:base>
71<br>
72<x:br><inner></inner></x:br>
73<col>
74<x:col><inner></inner></x:col>
75<embed>
76<x:embed><inner></inner></x:embed>
77<hr>
78<x:hr><inner></inner></x:hr>
79<img>
80<x:img><inner></inner></x:img>
81<input>
82<x:input><inner></inner></x:input>
83<link>
84<x:link><inner></inner></x:link>
85<meta>
86<x:meta><inner></inner></x:meta>
87<source>
88<x:source><inner></inner></x:source>
89<track>
90<x:track><inner></inner></x:track>
91<wbr>
92<x:wbr><inner></inner></x:wbr>
93<basefont>
94<x:basefont><inner></inner></x:basefont>
95<bgsound>
96<x:bgsound><inner></inner></x:bgsound>
97<frame>
98<x:frame><inner></inner></x:frame>
99<keygen>
100<x:keygen><inner></inner></x:keygen>
101<param>
102<x:param><inner></inner></x:param>
103</container>
104