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