| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <body> | |
| 4 <p>This test checks whether serialized invalid XHTML is valid XML (for bug 9901)
.</p> | |
| 5 <p>If the test passes, you'll see a series of 'PASS' messages below.</p> | |
| 6 <pre id="console"></pre> | |
| 7 | |
| 8 <script> | |
| 9 if (window.testRunner) | |
| 10 testRunner.dumpAsText(); | |
| 11 | |
| 12 function log(s) | |
| 13 { | |
| 14 document.getElementById('console').appendChild(document.createTextNode(s)); | |
| 15 } | |
| 16 | |
| 17 function shouldBe(a, b) | |
| 18 { | |
| 19 var evalA; | |
| 20 try { | |
| 21 evalA = eval(a); | |
| 22 } catch(e) { | |
| 23 evalA = e; | |
| 24 } | |
| 25 | |
| 26 if (evalA == b) | |
| 27 log('PASS: ' + a + ' should be ' + b + ' and is.\n'); | |
| 28 else | |
| 29 log('FAIL: ' + a + ' should be ' + b + ' but instead is ' + evalA + '.\n
'); | |
| 30 } | |
| 31 | |
| 32 var doc = (new DOMParser()).parseFromString('<input xmlns="http://www.w3.org/199
9/xhtml">123</input>', 'text/xml'); | |
| 33 var str = (new XMLSerializer()).serializeToString(doc); | |
| 34 | |
| 35 shouldBe('doc.firstChild.firstChild.nodeValue', '123'); | |
| 36 shouldBe('str', '<input xmlns=\"http://www.w3.org/1999/xhtml\">123</input>'); | |
| 37 </script> | |
| 38 </body> | |
| 39 </html> | |
| OLD | NEW |