OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function print(message, color) | 4 function print(message, color) |
5 { | 5 { |
6 var paragraph = document.createElement("div"); | 6 var paragraph = document.createElement("div"); |
7 paragraph.appendChild(document.createTextNode(message)); | 7 paragraph.appendChild(document.createTextNode(message)); |
8 paragraph.style.fontFamily = "monospace"; | 8 paragraph.style.fontFamily = "monospace"; |
9 if (color) | 9 if (color) |
10 paragraph.style.color = color; | 10 paragraph.style.color = color; |
(...skipping 24 matching lines...) Expand all Loading... |
35 doc = document.implementation.createHTMLDocument("title"); | 35 doc = document.implementation.createHTMLDocument("title"); |
36 shouldBe("doc.title", "title"); | 36 shouldBe("doc.title", "title"); |
37 shouldBe("doc.getElementsByTagName('html').length", 1); | 37 shouldBe("doc.getElementsByTagName('html').length", 1); |
38 shouldBe("doc.getElementsByTagName('head').length", 1); | 38 shouldBe("doc.getElementsByTagName('head').length", 1); |
39 shouldBe("doc.getElementsByTagName('title').length", 1); | 39 shouldBe("doc.getElementsByTagName('title').length", 1); |
40 shouldBe("doc.getElementsByTagName('body').length", 1); | 40 shouldBe("doc.getElementsByTagName('body').length", 1); |
41 | 41 |
42 print("[document with title '']"); | 42 print("[document with title '']"); |
43 doc = document.implementation.createHTMLDocument(""); | 43 doc = document.implementation.createHTMLDocument(""); |
44 shouldBe("doc.title", ""); | 44 shouldBe("doc.title", ""); |
| 45 shouldBe("doc.getElementsByTagName('title').item(0).firstChild.data", ""); |
45 | 46 |
46 print("[document with null title]"); | 47 print("[document with null title]"); |
47 doc = document.implementation.createHTMLDocument(null); | 48 doc = document.implementation.createHTMLDocument(null); |
48 shouldBe("doc.title", "null"); | 49 shouldBe("doc.title", "null"); |
49 } | 50 } |
50 </script> | 51 </script> |
51 </head> | 52 </head> |
52 | 53 |
53 <body onload="test();"> | 54 <body onload="test();"> |
54 <p>This page tests the DOM createHTMLDocument method.</p> | 55 <p>This page tests the DOM createHTMLDocument method.</p> |
55 <p>If the test passes, you'll see a series of 'PASS' messages below.</p> | 56 <p>If the test passes, you'll see a series of 'PASS' messages below.</p> |
56 <hr> | 57 <hr> |
57 | 58 |
58 <div id='console'></div> | 59 <div id='console'></div> |
59 | 60 |
60 </body> | 61 </body> |
61 </html> | 62 </html> |
OLD | NEW |