1--TEST--
2Dom\HTMLDocument serialization of different roots
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8// Note: can't create CData in an HTML document.
9$dom = Dom\XMLDocument::createEmpty();
10$cdata = $dom->createCDATASection("cdata");
11
12$dom = Dom\HTMLDocument::createEmpty();
13$container = $dom->appendChild($dom->createElement("container"));
14$comment = $container->appendChild($dom->createComment("comment"));
15$cdata = $container->appendChild($dom->importNode($cdata));
16$emptyElement = $container->appendChild($dom->createElement("empty"));
17$text = $container->appendChild($dom->createTextNode("text"));
18$pi = $container->appendChild($dom->createProcessingInstruction("target", "data"));
19$fragment = $dom->createDocumentFragment();
20
21var_dump($dom->saveHtml($comment));
22var_dump($dom->saveHtml($cdata));
23var_dump($dom->saveHtml($emptyElement));
24var_dump($dom->saveHtml($text));
25var_dump($dom->saveHtml($pi));
26var_dump($dom->saveHtml($fragment));
27
28?>
29--EXPECT--
30string(14) "<!--comment-->"
31string(5) "cdata"
32string(15) "<empty></empty>"
33string(4) "text"
34string(14) "<?target data>"
35string(0) ""
36