1--TEST--
2noscript behaviour
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8echo "--- Parsing ---\n";
9
10$dom = Dom\HTMLDocument::createFromString("<!doctype html><html><body><noscript><p>hi</p></noscript></body></html>", Dom\HTML_NO_DEFAULT_NS);
11var_dump($dom->documentElement->textContent);
12var_dump($dom->documentElement->namespaceURI);
13echo $dom->saveHtml(), "\n";
14echo $dom->saveXml(), "\n";
15
16echo "--- Modifying the text content: tag ---\n";
17
18$xpath = new Dom\XPath($dom);
19$noscript = $xpath->query("//noscript")[0];
20$noscript->textContent = "<p>bye</p>";
21echo $dom->saveHtml(), "\n";
22echo $dom->saveXml(), "\n";
23
24echo "--- Modifying the text content: trick ---\n";
25
26$noscript->textContent = "<!-- </noscript> -->";
27echo $dom->saveHtml(), "\n";
28echo $dom->saveXml(), "\n";
29
30?>
31--EXPECT--
32--- Parsing ---
33string(2) "hi"
34NULL
35<!DOCTYPE html><html><head></head><body><noscript><p>hi</p></noscript></body></html>
36<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
37<!DOCTYPE html>
38<html><head/><body><noscript><p>hi</p></noscript></body></html>
39--- Modifying the text content: tag ---
40<!DOCTYPE html><html><head></head><body><noscript>&lt;p&gt;bye&lt;/p&gt;</noscript></body></html>
41<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
42<!DOCTYPE html>
43<html><head/><body><noscript>&lt;p&gt;bye&lt;/p&gt;</noscript></body></html>
44--- Modifying the text content: trick ---
45<!DOCTYPE html><html><head></head><body><noscript>&lt;!-- &lt;/noscript&gt; --&gt;</noscript></body></html>
46<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
47<!DOCTYPE html>
48<html><head/><body><noscript>&lt;!-- &lt;/noscript&gt; --&gt;</noscript></body></html>
49