1--TEST--
2Test writing Element::$outerHTML on HTML documents
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
9$p = $dom->body->firstChild;
10$p->outerHTML = '<div></div>&nbsp;<p>'; // intentionally unclosed
11echo $dom->saveXML(), "\n";
12echo $dom->saveHtml(), "\n";
13$div = $dom->body->firstChild;
14$div->outerHTML = "invalid\xffutf-8������";
15echo $dom->saveXML(), "\n";
16echo $dom->saveHtml(), "\n";
17
18$dom->body->outerHTML = '<template><p>foo</p></template>';
19var_dump($dom->body->querySelector('p')); // Should be NULL because the template contents do not participate in the DOM tree
20echo $dom->saveXML(), "\n";
21echo $dom->saveHtml(), "\n";
22
23?>
24--EXPECT--
25<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
26<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><div></div> <p></p></body></html>
27<html><head></head><body><div></div>&nbsp;<p></p></body></html>
28<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
29<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>invalid�utf-8������ <p></p></body></html>
30<html><head></head><body>invalid�utf-8������&nbsp;<p></p></body></html>
31NULL
32<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
33<html xmlns="http://www.w3.org/1999/xhtml"><head></head><head><template><p>foo</p></template></head><body></body></html>
34<html><head></head><head><template><p>foo</p></template></head><body></body></html>
35