| <html> |
| <head> |
| <script> |
| function debug(str) { |
| li = document.createElement('li'); |
| li.appendChild(document.createTextNode(str)); |
| document.getElementById('console').appendChild(li); |
| } |
| |
| function runTests() { |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| |
| var docType = window.document.implementation.createDocumentType("aDocTypeName", "aPublicID", "aSystemID"); |
| |
| var serializer = new XMLSerializer(); |
| |
| try { |
| var text = serializer.serializeToString(docType); |
| debug("FAIL: XMLSerializer.serializeToString() should throw an exception if it tries to serialize a documentless DocumentType node."); |
| } catch (e) { |
| if (e == "Error: INVALID_ACCESS_ERR: DOM Exception 15") |
| debug("PASS: an " + e + " was thrown as expected.") |
| else |
| debug("FAIL: XMLSerializer.serializeToString() should throw an INVALID_ACCESS_ERR DOMExeption if it tries to serialize a documentless DocumentType node."); |
| } |
| } |
| </script> |
| </head> |
| <body onload="runTests()"> |
| This tests XMLSerializer.serializeToString() on a DocumentType node that does not have a document associated |
| with it. It should throw an INVALID_ACCESS_ERR DOMException. |
| |
| <ul id="console"> |
| </ul> |
| </body> |
| </html> |