Re-sync dom web-platform-tests from upstream
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / dom / historical.html
1 <!DOCTYPE html>
2
3 <title>Historical DOM features must be removed</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <div id=log></div>
7 <script>
8 function isInterfaceNuked(name) {
9   test(function() {
10     assert_equals(window[name], undefined)
11   }, "Historical DOM features must be removed: " + name)
12 }
13 var nukedInterfaces = [
14   "DOMConfiguration",
15   "DOMCursor",
16   "DOMError",
17   "DOMErrorHandler",
18   "DOMImplementationList",
19   "DOMImplementationSource",
20   "DOMLocator",
21   "DOMObject",
22   "DOMRequest",
23   "DOMSettableTokenList",
24   "DOMUserData",
25   "Entity",
26   "EntityReference",
27   "EventException", // DOM Events
28   "NameList",
29   "Notation",
30   "TypeInfo",
31   "UserDataHandler",
32   "RangeException" // DOM Range
33 ]
34 nukedInterfaces.forEach(isInterfaceNuked)
35
36 function isNukedFromDocument(name) {
37   test(function() {
38     var doc = document.implementation.createDocument(null,null,null)
39     assert_equals(document[name], undefined)
40     assert_equals(doc[name], undefined)
41   }, "Historical DOM features must be removed: " + name)
42 }
43 var documentNuked = [
44   "createEntityReference",
45   "xmlEncoding",
46   "xmlStandalone",
47   "xmlVersion",
48   "strictErrorChecking",
49   "domConfig",
50   "normalizeDocument",
51   "renameNode",
52   "defaultCharset",
53   "height",
54   "width",
55   // https://github.com/whatwg/html/commit/a64aea7fdb221bba027d95dc3cabda09e0b3e5dc
56   "commands",
57   // https://github.com/whatwg/html/commit/797b4d273955a0fe3cc2e2d0ca5d578f37c0f126
58   "cssElementMap",
59   // https://github.com/whatwg/html/commit/e236f46820b93d6fe2e2caae0363331075c6c4fb
60   "async",
61 ]
62 documentNuked.forEach(isNukedFromDocument)
63
64 test(function() {
65   // https://github.com/whatwg/html/commit/e236f46820b93d6fe2e2caae0363331075c6c4fb
66   assert_false("load" in document);
67 }, "document.load");
68
69 test(function() {
70   // https://github.com/whatwg/html/commit/523f7a8773d2ab8a1eb0da6510651e8c5d2a7531
71   var doc = document.implementation.createDocument(null, null, null);
72   assert_false("load" in doc);
73 }, "XMLDocument.load");
74
75 test(function() {
76   assert_equals(document.implementation["getFeature"], undefined)
77 }, "DOMImplementation.getFeature() must be nuked.")
78
79 function isNukedFromElement(name) {
80   test(function() {
81     var ele = document.createElementNS("test", "test")
82     assert_equals(document.body[name], undefined)
83     assert_equals(ele[name], undefined)
84   }, "Historical DOM features must be removed: " + name)
85 }
86 var elementNuked = [
87   "schemaTypeInfo",
88   "setIdAttribute",
89   "setIdAttributeNS",
90   "setIdAttributeNode"
91 ]
92 elementNuked.forEach(isNukedFromElement)
93
94 function isNukedFromAttr(name) {
95   test(function() {
96     var attr = document.createAttribute("test")
97     assert_equals(attr[name], undefined)
98   }, "Attr member must be nuked: " + name)
99 }
100 var attrNuked = [
101   "schemaTypeInfo",
102   "isId"
103 ]
104 attrNuked.forEach(isNukedFromAttr)
105
106 function isNukedFromDoctype(name) {
107   test(function() {
108     var doctype = document.implementation.createDocumentType("test", "", "")
109     assert_equals(doctype[name], undefined)
110   }, "DocumentType member must be nuked: " + name)
111 }
112 var doctypeNuked = [
113   "entities",
114   "notations",
115   "internalSubset"
116 ]
117 doctypeNuked.forEach(isNukedFromDoctype)
118
119 function isNukedFromText(name) {
120   test(function() {
121     var text = document.createTextNode("test")
122     assert_equals(text[name], undefined)
123   }, "Text member must be nuked: " + name)
124 }
125 var textNuked = [
126   "isElementContentWhitespace",
127   "replaceWholeText"
128 ]
129 textNuked.forEach(isNukedFromText)
130
131 function isNukedFromNode(name) {
132   test(function() {
133     var doc = document.implementation.createDocument(null,null,null)
134     var doctype = document.implementation.createDocumentType("test", "", "")
135     var text = document.createTextNode("test")
136     assert_equals(doc[name], undefined)
137     assert_equals(doctype[name], undefined)
138     assert_equals(text[name], undefined)
139   }, "Node member must be nuked: " + name)
140 }
141 var nodeNuked = [
142   "hasAttributes",
143   "attributes",
144   "namespaceURI",
145   "prefix",
146   "localName",
147   "isSupported",
148   "getFeature",
149   "getUserData",
150   "setUserData",
151   "rootNode",
152 ]
153 nodeNuked.forEach(isNukedFromNode)
154
155 function isNukedFromWindow(name) {
156   test(function() {
157     assert_equals(window[name], undefined)
158   }, "Window member must be nuked: " + name)
159 }
160 var windowNuked = [
161   "attachEvent"
162 ]
163 windowNuked.forEach(isNukedFromWindow)
164
165 function isRemovedFromEvent(name) {
166   test(() => {
167     assert_equals(Event[name], undefined)
168   }, "Event should not have this constant: " + name)
169 }
170 var EventRemoved = [
171   "MOUSEDOWN",
172   "MOUSEUP",
173   "MOUSEOVER",
174   "MOUSEOUT",
175   "MOUSEMOVE",
176   "MOUSEDRAG",
177   "CLICK",
178   "DBLCLICK",
179   "KEYDOWN",
180   "KEYUP",
181   "KEYPRESS",
182   "DRAGDROP",
183   "FOCUS",
184   "BLUR",
185   "SELECT",
186   "CHANGE"
187 ]
188 EventRemoved.forEach(isRemovedFromEvent)
189
190 var EventPrototypeRemoved = [
191   "getPreventDefault",
192 ]
193 EventPrototypeRemoved.forEach(name => {
194   test(() => {
195     assert_equals(Event.prototype[name], undefined)
196     assert_equals((new Event("test"))[name], undefined)
197   }, "Event.prototype should not have this property: " + name)
198 })
199 </script>