content/base/test/test_bug500937.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug500937.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=500937
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 500937</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500937">Mozilla Bug 500937</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  <iframe id=iframe src="about:blank"></iframe>
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 500937 **/
    1.24 +
    1.25 +var d = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null);
    1.26 +var h = d.documentElement;
    1.27 +h.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "head"));
    1.28 +var b = d.createElementNS("http://www.w3.org/1999/xhtml", "body");
    1.29 +h.appendChild(b);
    1.30 +
    1.31 +b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "div"));
    1.32 +b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "script"));
    1.33 +b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "br"));
    1.34 +b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "source"));
    1.35 +b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "param"));
    1.36 +b.appendChild(d.createTextNode("\u00A0"));
    1.37 +
    1.38 +is(new XMLSerializer().serializeToString(d), 
    1.39 +   '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><div></div><script><\/script><br /><source /><param />\u00A0</body></html>', 
    1.40 +   "XML DOM input to XMLSerializer");
    1.41 +
    1.42 +d = document.getElementById('iframe').contentWindow.document;
    1.43 +
    1.44 +while(d.documentElement.previousSibling) {
    1.45 +  d.removeChild(d.documentElement.previousSibling);
    1.46 +}
    1.47 +
    1.48 +d.replaceChild(h, d.documentElement);
    1.49 +
    1.50 +is(new XMLSerializer().serializeToString(d),  
    1.51 +   '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><div></div><script><\/script><br /><source /><param />\u00A0</body></html>', 
    1.52 +   "HTML DOM input to XMLSerializer");
    1.53 +
    1.54 +</script>
    1.55 +</pre>
    1.56 +</body>
    1.57 +</html>

mercurial