blob: db82f85dd4ad2a2ee15e7c73db1541465a67057b [file] [log] [blame]
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script type="text/javascript">
test(() => {
var ns = 'http://www.w3.org/1999/xhtml';
var xhtml = document.implementation.createDocument(ns , 'html', null);
var p = xhtml.createElementNS(ns, 'p');
p.textContent = '(0 < 1 && 1 > 0)';
xhtml.documentElement.appendChild(p);
var script = xhtml.createElementNS(ns, 'script');
script.textContent = 'if (0 < 1 && 1 > 0) { };';
xhtml.documentElement.appendChild(script);
var style = xhtml.createElementNS(ns, 'style');
style.textContent = '/* < > & */';
xhtml.documentElement.appendChild(style);
var serializer = new XMLSerializer();
var xmlString = serializer.serializeToString(xhtml);
assert_equals(xmlString, "<html xmlns=\"http://www.w3.org/1999/xhtml\"><p>(0 &lt; 1 &amp;&amp; 1 &gt; 0)</p><script>if (0 &lt; 1 &amp;&amp; 1 &gt; 0) { };<\/script><style>/* &lt; &gt; &amp; */</style></html>");
}, 'XMLSerializer: Serializes entities to XML-compatible format');
</script>
</head>
<body>
</body>
</html>