OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style type="text/css"> | 3 <style type="text/css"> |
4 .pass { color: green; } | 4 .pass { color: green; } |
5 .fail { color: red; } | 5 .fail { color: red; } |
6 </style> | 6 </style> |
7 <script> | 7 <script> |
8 function printOut(msg) | 8 function printOut(msg) |
9 { | 9 { |
10 var console = document.getElementById("console"); | 10 var console = document.getElementById("console"); |
11 var span = document.createElement('span'); | 11 var span = document.createElement('span'); |
12 span.innerHTML = msg + '<br>'; | 12 span.innerHTML = msg + '<br>'; |
13 console.appendChild(span); | 13 console.appendChild(span); |
14 } | 14 } |
15 | 15 |
16 function resultStringifier(result) | 16 function resultStringifier(result) |
17 { | 17 { |
18 if (result === "") | 18 if (result === "") |
19 return "<b>the empty string</b>"; | 19 return "<b>the empty string</b>"; |
20 else if (result === null) | 20 else if (result === null) |
21 return "<b>null</b>"; | 21 return "<b>null</b>"; |
| 22 else if (result === "null") |
| 23 return "<b>'null'</b>"; |
22 else if (result === undefined) | 24 else if (result === undefined) |
23 return "<b>undefined</b>"; | 25 return "<b>undefined</b>"; |
24 return "the string '" + result + "'"; | 26 return "the string '" + result + "'"; |
25 } | 27 } |
26 | 28 |
27 function nullTestDocumentAttribute(documentType, doc, attr, expected, ex
pectedExceptionCode) | 29 function nullTestDocumentAttribute(documentType, doc, attr, expected, ex
pectedExceptionCode) |
28 { | 30 { |
29 var result; | 31 var result; |
30 try { | 32 try { |
31 doc[attr] = null; | 33 doc[attr] = null; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 {name: 'defaultCharset', expectedNull: undefined}, | 72 {name: 'defaultCharset', expectedNull: undefined}, |
71 {name: 'characterSet', expectedNull: 'UTF-8'}, | 73 {name: 'characterSet', expectedNull: 'UTF-8'}, |
72 {name: 'inputEncoding', expectedNull: 'UTF-8'}, | 74 {name: 'inputEncoding', expectedNull: 'UTF-8'}, |
73 {name: 'selectedStylesheetSet', expectedNull: null} | 75 {name: 'selectedStylesheetSet', expectedNull: null} |
74 ] | 76 ] |
75 }, | 77 }, |
76 { | 78 { |
77 typeName: 'HTMLDocument', | 79 typeName: 'HTMLDocument', |
78 docToUse: htmlDoc, | 80 docToUse: htmlDoc, |
79 attributes: [ | 81 attributes: [ |
80 {name: 'title', expectedNull: ''}, | 82 {name: 'title', expectedNull: 'null'}, |
81 {name: 'cookie', expectedNull: ''}, | 83 {name: 'cookie', expectedNull: ''}, |
82 {name: 'bgColor', expectedNull: ''}, | 84 {name: 'bgColor', expectedNull: ''}, |
83 {name: 'fgColor', expectedNull: ''}, | 85 {name: 'fgColor', expectedNull: ''}, |
84 {name: 'alinkColor', expectedNull: ''}, | 86 {name: 'alinkColor', expectedNull: ''}, |
85 {name: 'linkColor', expectedNull: ''}, | 87 {name: 'linkColor', expectedNull: ''}, |
86 {name: 'vlinkColor', expectedNull: ''}, | 88 {name: 'vlinkColor', expectedNull: ''}, |
87 {name: 'dir', expectedNull: ''}, | 89 {name: 'dir', expectedNull: ''}, |
88 {name: 'designMode', expectedNull: 'off'} | 90 {name: 'designMode', expectedNull: 'off'} |
89 ] | 91 ] |
90 } | 92 } |
91 ]; | 93 ]; |
92 | 94 |
93 for (doc in listing) { | 95 for (doc in listing) { |
94 var typeName = listing[doc].typeName; | 96 var typeName = listing[doc].typeName; |
95 var docToUse = listing[doc].docToUse; | 97 var docToUse = listing[doc].docToUse; |
96 var attrs = listing[doc].attributes; | 98 var attrs = listing[doc].attributes; |
97 for (attr in attrs) { | 99 for (attr in attrs) { |
98 nullTestDocumentAttribute(typeName, docToUse, attrs[attr].na
me, attrs[attr].expectedNull, attrs[attr].expectedExceptionCode); | 100 nullTestDocumentAttribute(typeName, docToUse, attrs[attr].na
me, attrs[attr].expectedNull, attrs[attr].expectedExceptionCode); |
99 } | 101 } |
100 printOut(''); | 102 printOut(''); |
101 } | 103 } |
102 } | 104 } |
103 </script> | 105 </script> |
104 </head> | 106 </head> |
105 <body onload="runTests()"> | 107 <body onload="runTests()"> |
106 <p>This test setting various attributes of documents to JavaScript null.</p> | 108 <p>This test setting various attributes of documents to JavaScript null.</p> |
107 <div id="console"></div> | 109 <div id="console"></div> |
108 </body> | 110 </body> |
109 </html> | 111 </html> |
OLD | NEW |