OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function debug(str) { | 4 function debug(str) { |
5 li = document.createElement('li'); | 5 li = document.createElement('li'); |
6 li.appendChild(document.createTextNode(str)); | 6 li.appendChild(document.createTextNode(str)); |
7 document.getElementById('console').appendChild(li); | 7 document.getElementById('console').appendChild(li); |
8 } | 8 } |
9 | 9 |
10 function runTests() { | 10 function runTests() { |
11 if (window.testRunner) | 11 if (window.testRunner) |
12 testRunner.dumpAsText(); | 12 testRunner.dumpAsText(); |
13 | 13 |
14 var docType = window.document.implementation.createDocumentType("aDo
cTypeName", "aPublicID", "aSystemID"); | 14 var docType = window.document.implementation.createDocumentType("aDo
cTypeName", "aPublicID", "aSystemID"); |
15 | 15 |
16 var serializer = new XMLSerializer(); | 16 var serializer = new XMLSerializer(); |
17 | 17 |
18 try { | 18 try { |
19 var text = serializer.serializeToString(docType); | 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."); | 20 debug("FAIL: XMLSerializer.serializeToString() should throw an e
xception if it tries to serialize a documentless DocumentType node."); |
21 } catch (e) { | 21 } catch (e) { |
22 if (e == "Error: InvalidAccessError: DOM Exception 15") | 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.") | 23 debug("PASS: an " + e + " was thrown as expected.") |
24 else | 24 else |
25 debug("FAIL: XMLSerializer.serializeToString() should throw
an INVALID_ACCESS_ERR DOMExeption if it tries to serialize a documentless Docume
ntType node."); | 25 debug("FAIL: XMLSerializer.serializeToString() should throw
an InvalidAccessError DOMExeption if it tries to serialize a documentless Docume
ntType node."); |
26 } | 26 } |
27 } | 27 } |
28 </script> | 28 </script> |
29 </head> | 29 </head> |
30 <body onload="runTests()"> | 30 <body onload="runTests()"> |
31 This tests XMLSerializer.serializeToString() on a DocumentType node that does no
t have a document associated | 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. | 32 with it. It should throw an INVALID_ACCESS_ERR DOMException. |
33 | 33 |
34 <ul id="console"> | 34 <ul id="console"> |
35 </ul> | 35 </ul> |
36 </body> | 36 </body> |
37 </html> | 37 </html> |
OLD | NEW |