test_bug500937.html (1970B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=500937 5 --> 6 <head> 7 <title>Test for Bug 500937</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500937">Mozilla Bug 500937</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 <iframe id=iframe src="about:blank"></iframe> 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 500937 */ 21 22 var d = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null); 23 var h = d.documentElement; 24 h.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "head")); 25 var b = d.createElementNS("http://www.w3.org/1999/xhtml", "body"); 26 h.appendChild(b); 27 28 b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "div")); 29 b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "script")); 30 b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "br")); 31 b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "source")); 32 b.appendChild(d.createElementNS("http://www.w3.org/1999/xhtml", "param")); 33 b.appendChild(d.createTextNode("\u00A0")); 34 35 is(new XMLSerializer().serializeToString(d), 36 '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><div></div><script><\/script><br /><source /><param />\u00A0</body></html>', 37 "XML DOM input to XMLSerializer"); 38 39 d = document.getElementById('iframe').contentWindow.document; 40 41 while(d.documentElement.previousSibling) { 42 d.removeChild(d.documentElement.previousSibling); 43 } 44 45 d.replaceChild(h, d.documentElement); 46 47 is(new XMLSerializer().serializeToString(d), 48 '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><div></div><script><\/script><br /><source /><param />\u00A0</body></html>', 49 "HTML DOM input to XMLSerializer"); 50 51 </script> 52 </pre> 53 </body> 54 </html>