mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
30 lines
588 B
PHP
30 lines
588 B
PHP
--TEST--
|
|
Testing reading and writing to DOMNode::textContent
|
|
--SKIPIF--
|
|
<?php require_once('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$html = <<<HTML
|
|
<div id="test"><span>hi there</span></div>
|
|
HTML;
|
|
|
|
$text = '<p>hello world ™</p>';
|
|
|
|
$dom = new DOMDocument('1.0', 'UTF-8');
|
|
$dom->loadHTML($html);
|
|
|
|
$node = $dom->getElementById('test');
|
|
var_dump($node->textContent);
|
|
$node->textContent = $text;
|
|
var_dump($node->textContent == $text);
|
|
|
|
var_dump($dom->saveHTML($node));
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(8) "hi there"
|
|
bool(true)
|
|
string(63) "<div id="test"><p>hello world &trade;</p></div>"
|
|
|