| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script src="../js/resources/js-test-pre.js"></script> |
| 4 function debug(str) { | 4 </head> |
| 5 li = document.createElement('li'); | 5 <body> |
| 6 li.appendChild(document.createTextNode(str)); | 6 <script> |
| 7 document.getElementById('console').appendChild(li); | 7 description("This tests XMLSerializer.serializeToString() on a newly created Doc
umentType node does not throw since the node has an associated document."); |
| 8 } | |
| 9 | 8 |
| 10 function runTests() { | 9 var docType = window.document.implementation.createDocumentType("aDocTypeName",
"aPublicID", "aSystemID"); |
| 11 if (window.testRunner) | 10 var serializer = new XMLSerializer(); |
| 12 testRunner.dumpAsText(); | |
| 13 | 11 |
| 14 var docType = window.document.implementation.createDocumentType("aDo
cTypeName", "aPublicID", "aSystemID"); | 12 var text; |
| 15 | 13 shouldNotThrow("text = serializer.serializeToString(docType)"); |
| 16 var serializer = new XMLSerializer(); | 14 shouldBeEqualToString("text", "<!DOCTYPE aDocTypeName PUBLIC \"aPublicID\" \"aSy
stemID\">"); |
| 17 | 15 </script> |
| 18 try { | 16 <script src="../js/resources/js-test-pre.js"></script> |
| 19 var text = serializer.serializeToString(docType); | |
| 20 debug("FAIL: XMLSerializer.serializeToString() should throw an e
xception if it tries to serialize a documentless DocumentType node."); | |
| 21 } catch (e) { | |
| 22 if (e == "InvalidAccessError: A parameter or an operation was no
t supported by the underlying object.") | |
| 23 debug("PASS: an " + e + " was thrown as expected.") | |
| 24 else | |
| 25 debug("FAIL: XMLSerializer.serializeToString() should throw
an InvalidAccessError DOMExeption if it tries to serialize a documentless Docume
ntType node."); | |
| 26 } | |
| 27 } | |
| 28 </script> | |
| 29 </head> | |
| 30 <body onload="runTests()"> | |
| 31 This tests XMLSerializer.serializeToString() on a DocumentType node that does no
t have a document associated | |
| 32 with it. It should throw an INVALID_ACCESS_ERR DOMException. | |
| 33 | |
| 34 <ul id="console"> | |
| 35 </ul> | |
| 36 </body> | 17 </body> |
| 37 </html> | 18 </html> |
| OLD | NEW |