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
|
--TEST--
<template> element manual creation
--EXTENSIONS--
dom
--FILE--
<?php
echo "=== After creation ===\n";
$dom = Dom\HTMLDocument::createEmpty();
$template = $dom->appendChild($dom->createElement("template"));
var_dump($template->innerHTML);
echo $dom->saveXML(), "\n";
echo $dom->saveHTML(), "\n";
echo "=== After setting content ===\n";
$template->innerHTML = "<p>hello</template></p>";
var_dump($template->innerHTML);
var_dump($template->firstChild);
echo $dom->saveXML(), "\n";
echo $dom->saveHTML(), "\n";
?>
--EXPECT--
=== After creation ===
string(0) ""
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template xmlns="http://www.w3.org/1999/xhtml"></template>
<template></template>
=== After setting content ===
string(12) "<p>hello</p>"
NULL
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template xmlns="http://www.w3.org/1999/xhtml"><p>hello</p></template>
<template><p>hello</p></template>
|