blob: 8d650bfb4627a16b7008645507c8247ec7858795 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<body>
<p>This test checks whether serialized invalid XHTML is valid XML (for bug 9901).</p>
<p>If the test passes, you'll see a series of 'PASS' messages below.</p>
<pre id="console"></pre>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(s)
{
document.getElementById('console').appendChild(document.createTextNode(s));
}
function shouldBe(a, b)
{
var evalA;
try {
evalA = eval(a);
} catch(e) {
evalA = e;
}
if (evalA == b)
log('PASS: ' + a + ' should be ' + b + ' and is.\n');
else
log('FAIL: ' + a + ' should be ' + b + ' but instead is ' + evalA + '.\n');
}
var doc = (new DOMParser()).parseFromString('<input xmlns="http://www.w3.org/1999/xhtml">123</input>', 'text/xml');
var str = (new XMLSerializer()).serializeToString(doc);
shouldBe('doc.firstChild.firstChild.nodeValue', '123');
shouldBe('str', '<input xmlns=\"http://www.w3.org/1999/xhtml\">123</input>');
</script>
</body>
</html>