OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <div id="element" name="element_name"></div> | 6 <div id="element" name="element_name"></div> |
7 <script> | 7 <script> |
8 description('This test checks that all but a handful of dom constructors throw e
xceptions, and the rest return reasonable objects. It also tests that those cons
tructors have higher precedence than a document element with the same ID or name
.'); | 8 description('This test checks that all but a handful of dom constructors throw e
xceptions, and the rest return reasonable objects. It also tests that those cons
tructors have higher precedence than a document element with the same ID or name
.'); |
9 | 9 |
10 var element = document.getElementById("element"); | 10 var element = document.getElementById("element"); |
11 | 11 |
12 // These objects should throw an exception when their constructor is called | 12 // These objects should throw an exception when their constructor is called |
13 // with no arguments. (Some of them may have working constructors that require | 13 // with no arguments. (Some of them may have working constructors that require |
14 // arguments to be valid.) | 14 // arguments to be valid.) |
15 var objects_exception = [ | 15 var objects_exception = [ |
16 'Attr', | 16 'Attr', |
17 'CharacterData', | 17 'CharacterData', |
18 'CDATASection', | 18 'CDATASection', |
19 'Document', | |
20 'DocumentType', | 19 'DocumentType', |
21 'Element', | 20 'Element', |
22 'EventTarget', | 21 'EventTarget', |
23 'HTMLDocument', | 22 'HTMLDocument', |
24 'Node', | 23 'Node', |
25 'ProcessingInstruction', | 24 'ProcessingInstruction', |
26 'HTMLAllCollection', | 25 'HTMLAllCollection', |
27 'HTMLAnchorElement', | 26 'HTMLAnchorElement', |
28 'HTMLAreaElement', | 27 'HTMLAreaElement', |
29 'HTMLBaseElement', | 28 'HTMLBaseElement', |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 'TreeWalker', | 116 'TreeWalker', |
118 'XPathExpression', | 117 'XPathExpression', |
119 'Worker' | 118 'Worker' |
120 ]; | 119 ]; |
121 | 120 |
122 // These objects should have a working constructor. | 121 // These objects should have a working constructor. |
123 var objects_constructor = [ | 122 var objects_constructor = [ |
124 'Comment', | 123 'Comment', |
125 'DataTransfer', | 124 'DataTransfer', |
126 'DOMParser', | 125 'DOMParser', |
| 126 'Document', |
127 'DocumentFragment', | 127 'DocumentFragment', |
128 'Range', | 128 'Range', |
129 'Text', | 129 'Text', |
130 'XMLHttpRequest', | 130 'XMLHttpRequest', |
131 'XMLSerializer', | 131 'XMLSerializer', |
132 'XPathEvaluator', | 132 'XPathEvaluator', |
133 'XSLTProcessor' | 133 'XSLTProcessor' |
134 ]; | 134 ]; |
135 | 135 |
136 // These objects should have no constructor. | 136 // These objects should have no constructor. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 "'[object " + objects_different_constructor[obj] + "]'"); | 197 "'[object " + objects_different_constructor[obj] + "]'"); |
198 element.id = "element"; | 198 element.id = "element"; |
199 element.name = obj; | 199 element.name = obj; |
200 shouldBe("TryAllocate('" + obj + "')", | 200 shouldBe("TryAllocate('" + obj + "')", |
201 "'[object " + objects_different_constructor[obj] + "]'"); | 201 "'[object " + objects_different_constructor[obj] + "]'"); |
202 element.name = "element_name"; | 202 element.name = "element_name"; |
203 } | 203 } |
204 </script> | 204 </script> |
205 </body> | 205 </body> |
206 </html> | 206 </html> |
OLD | NEW |