2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / LayoutTests / fast / dom / createDocumentType2.html
blobcbdad3c8b19619fe425a38fcfabe23f81e4a4c52
1 <html>
2 <head>
3 <script>
5 function debug(str)
7 document.getElementById('console').appendChild(document.createTextNode(str))
10 function runTest()
12 if (window.layoutTestController)
13 layoutTestController.dumpAsText();
15 try {
16 // add two docType elements to test handling multiple addition of docTypes, since document has no docType initially
17 document.appendChild(document.implementation.createDocumentType("example", "http://www.example.com/", "myDoc.dtd"));
18 document.appendChild(document.implementation.createDocumentType("example", "http://www.example.com/", "myDoc.dtd"));
19 debug("FAILURE: Did not throw exception and should throw node hierarchy error.");
20 return;
22 catch (e) {
23 if (e.code != 3) {
24 debug("FAILURE: Threw an exception with a code other than 3; should throw node hierarchy error.");
25 return;
29 debug('SUCCESS!')
32 </script>
33 </head>
34 <body onload="runTest();">
35 This tests that a document only supports having one doctype.
36 If the test is successful, 'SUCCESS' will be displayed below, otherwise 'FAILURE' and a reason will be displayed.
37 <pre id="console"></pre>
38 </body>
39 </html>