1--TEST--
2Document::createElement()
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8require __DIR__ . "/element_dump.inc";
9
10echo "--- Into rootless document ---\n";
11
12$dom = DOM\HTMLDocument::createEmpty();
13$element = $dom->createElement("HTML");
14$element->textContent = "&hello";
15dumpElement($element);
16
17$element = $dom->createElement("HEad");
18dumpElement($element);
19
20echo "--- Into document with HTML root ---\n";
21
22$dom = DOM\HTMLDocument::createEmpty();
23$element = $dom->createElement("HTML");
24$element->textContent = "&hello";
25$dom->appendChild($element);
26$element = $dom->createElement("HEad");
27dumpElement($element);
28
29echo "--- Into document with non-HTML root ---\n";
30
31$dom = DOM\HTMLDocument::createEmpty();
32$element = $dom->createElementNS("urn:a", "container");
33$dom->appendChild($element);
34$element = $dom->createElement("HEad");
35dumpElement($element);
36
37?>
38--EXPECT--
39--- Into rootless document ---
40tagName: string(4) "HTML"
41nodeName: string(4) "HTML"
42textContent: string(6) "&hello"
43prefix: NULL
44namespaceURI: string(28) "http://www.w3.org/1999/xhtml"
45<html>&amp;hello</html>
46
47tagName: string(4) "HEAD"
48nodeName: string(4) "HEAD"
49textContent: string(0) ""
50prefix: NULL
51namespaceURI: string(28) "http://www.w3.org/1999/xhtml"
52<head></head>
53
54--- Into document with HTML root ---
55tagName: string(4) "HEAD"
56nodeName: string(4) "HEAD"
57textContent: string(0) ""
58prefix: NULL
59namespaceURI: string(28) "http://www.w3.org/1999/xhtml"
60<head></head>
61
62--- Into document with non-HTML root ---
63tagName: string(4) "HEAD"
64nodeName: string(4) "HEAD"
65textContent: string(0) ""
66prefix: NULL
67namespaceURI: string(28) "http://www.w3.org/1999/xhtml"
68<head></head>
69