2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / LayoutTests / fast / dom / XMLSerializer-doctype2.html
blobefe1cc60b14b04d03758b5b7250bc7afb67d7388
1 <html>
2 <head>
3 <script>
4 function debug(str) {
5 li = document.createElement('li');
6 li.appendChild(document.createTextNode(str));
7 document.getElementById('console').appendChild(li);
10 function runTests() {
11 if (window.layoutTestController)
12 layoutTestController.dumpAsText();
14 var docType = window.document.implementation.createDocumentType("aDocTypeName", "aPublicID", "aSystemID");
16 var serializer = new XMLSerializer();
18 try {
19 var text = serializer.serializeToString(docType);
20 debug("FAIL: XMLSerializer.serializeToString() should throw an exception if it tries to serialize a documentless DocumentType node.");
21 } catch (e) {
22 if (e == "Error: INVALID_ACCESS_ERR: DOM Exception 15")
23 debug("PASS: an " + e + " was thrown as expected.")
24 else
25 debug("FAIL: XMLSerializer.serializeToString() should throw an INVALID_ACCESS_ERR DOMExeption if it tries to serialize a documentless DocumentType node.");
28 </script>
29 </head>
30 <body onload="runTests()">
31 This tests XMLSerializer.serializeToString() on a DocumentType node that does not have a document associated
32 with it. It should throw an INVALID_ACCESS_ERR DOMException.
34 <ul id="console">
35 </ul>
36 </body>
37 </html>