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); |
arv (Not doing code reviews)
2013/08/20 14:38:11
Maybe we should assert that the text is correct to
do-not-use
2013/08/20 15:31:00
Done.
| |
20 debug("FAIL: XMLSerializer.serializeToString() should throw an e xception if it tries to serialize a documentless DocumentType node."); | 20 debug("PASS: XMLSerializer.serializeToString() serialized the ne wly created DocumentType node without throwing."); |
21 } catch (e) { | 21 } catch (e) { |
22 if (e == "InvalidAccessError: A parameter or an operation was no t supported by the underlying object.") | 22 debug("FAIL: an " + e + " was thrown as expected.") |
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 } | 23 } |
27 } | 24 } |
28 </script> | 25 </script> |
29 </head> | 26 </head> |
30 <body onload="runTests()"> | 27 <body onload="runTests()"> |
arv (Not doing code reviews)
2013/08/20 14:38:11
no need to wait for onload
do-not-use
2013/08/20 15:31:00
Done.
| |
31 This tests XMLSerializer.serializeToString() on a DocumentType node that does no t have a document associated | 28 This tests XMLSerializer.serializeToString() on a newly created DocumentType nod e does not throw since the node has an |
32 with it. It should throw an INVALID_ACCESS_ERR DOMException. | 29 associated document. |
33 | 30 |
34 <ul id="console"> | 31 <ul id="console"> |
35 </ul> | 32 </ul> |
36 </body> | 33 </body> |
37 </html> | 34 </html> |
OLD | NEW |