summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/historical.html
blob: 1bc209ec0e775026a2464a67ac708efddbdc97c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<title>Historical DOM features must be removed</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
function isInterfaceRemoved(name) {
  test(function() {
    assert_false(name in window)
    assert_equals(window[name], undefined)
  }, "Historical DOM features must be removed: " + name)
}
var removedInterfaces = [
  "DOMConfiguration",
  "DOMCursor",
  "DOMError",
  "DOMErrorHandler",
  "DOMImplementationList",
  "DOMImplementationSource",
  "DOMLocator",
  "DOMObject",
  "DOMRequest",
  "DOMSettableTokenList",
  "DOMUserData",
  "Entity",
  "EntityReference",
  "EventException", // DOM Events
  "NameList",
  "Notation",
  "TypeInfo",
  "UserDataHandler",
  "RangeException", // DOM Range
  "SVGPathSegList"
]
removedInterfaces.forEach(isInterfaceRemoved)

function isRemovedFromDocument(name) {
  test(function() {
    var doc = document.implementation.createDocument(null,null,null)
    assert_false(name in document)
    assert_equals(document[name], undefined)
    assert_false(name in doc)
    assert_equals(doc[name], undefined)
  }, "Historical DOM features must be removed: " + name)
}
var documentRemoved = [
  "createEntityReference",
  "xmlEncoding",
  "xmlStandalone",
  "xmlVersion",
  "strictErrorChecking",
  "domConfig",
  "normalizeDocument",
  "renameNode",
  "defaultCharset",
  "height",
  "width",
  // https://github.com/whatwg/html/commit/a64aea7fdb221bba027d95dc3cabda09e0b3e5dc
  "commands",
  // https://github.com/whatwg/html/commit/797b4d273955a0fe3cc2e2d0ca5d578f37c0f126
  "cssElementMap",
  // https://github.com/whatwg/html/commit/e236f46820b93d6fe2e2caae0363331075c6c4fb
  "async",
  // https://github.com/whatwg/dom/pull/815
  "origin",
]
documentRemoved.forEach(isRemovedFromDocument)

test(function() {
  // https://github.com/whatwg/html/commit/e236f46820b93d6fe2e2caae0363331075c6c4fb
  assert_false("load" in document);
  assert_equals(document["load"], undefined)
}, "document.load");

test(function() {
  // https://github.com/whatwg/html/commit/523f7a8773d2ab8a1eb0da6510651e8c5d2a7531
  var doc = document.implementation.createDocument(null, null, null);
  assert_false("load" in doc);
  assert_equals(doc["load"], undefined)
}, "XMLDocument.load");

test(function() {
  assert_false("getFeature" in document.implementation)
  assert_equals(document.implementation["getFeature"], undefined)
}, "DOMImplementation.getFeature() must be removed.")

function isRemovedFromElement(name) {
  test(function() {
    var ele = document.createElementNS("test", "test")
    assert_false(name in document.body)
    assert_equals(document.body[name], undefined)
    assert_false(name in ele)
    assert_equals(ele[name], undefined)
  }, "Historical DOM features must be removed: " + name)
}
var elementRemoved = [
  "schemaTypeInfo",
  "setIdAttribute",
  "setIdAttributeNS",
  "setIdAttributeNode"
]
elementRemoved.forEach(isRemovedFromElement)

function isRemovedFromAttr(name) {
  test(function() {
    var attr = document.createAttribute("test")
    assert_false(name in attr)
    assert_equals(attr[name], undefined)
  }, "Attr member must be removed: " + name)
}
var attrRemoved = [
  "schemaTypeInfo",
  "isId"
]
attrRemoved.forEach(isRemovedFromAttr)

function isRemovedFromDoctype(name) {
  test(function() {
    var doctype = document.implementation.createDocumentType("test", "", "")
    assert_false(name in doctype)
    assert_equals(doctype[name], undefined)
  }, "DocumentType member must be removed: " + name)
}
var doctypeRemoved = [
  "entities",
  "notations",
  "internalSubset"
]
doctypeRemoved.forEach(isRemovedFromDoctype)

function isRemovedFromText(name) {
  test(function() {
    var text = document.createTextNode("test")
    assert_false(name in text)
    assert_equals(text[name], undefined)
  }, "Text member must be removed: " + name)
}
var textRemoved = [
  "isElementContentWhitespace",
  "replaceWholeText"
]
textRemoved.forEach(isRemovedFromText)

function isRemovedFromNode(name) {
  test(function() {
    var doc = document.implementation.createDocument(null,null,null)
    var doctype = document.implementation.createDocumentType("test", "", "")
    var text = document.createTextNode("test")
    assert_false(name in doc)
    assert_equals(doc[name], undefined)
    assert_false(name in doctype)
    assert_equals(doctype[name], undefined)
    assert_false(name in text)
    assert_equals(text[name], undefined)
  }, "Node member must be removed: " + name)
}
var nodeRemoved = [
  "hasAttributes",
  "attributes",
  "namespaceURI",
  "prefix",
  "localName",
  "isSupported",
  "getFeature",
  "getUserData",
  "setUserData",
  "rootNode",
]
nodeRemoved.forEach(isRemovedFromNode)

function isRemovedFromWindow(name) {
  test(function() {
    assert_false(name in window)
    assert_equals(window[name], undefined)
  }, "Window member must be removed: " + name)
}
var windowRemoved = [
  "attachEvent",
  "content",
  "sidebar",
]
windowRemoved.forEach(isRemovedFromWindow)

function isRemovedFromEvent(name) {
  test(() => {
    assert_false(name in Event)
    assert_equals(Event[name], undefined)
  }, "Event should not have this constant: " + name)
}
var EventRemoved = [
  "MOUSEDOWN",
  "MOUSEUP",
  "MOUSEOVER",
  "MOUSEOUT",
  "MOUSEMOVE",
  "MOUSEDRAG",
  "CLICK",
  "DBLCLICK",
  "KEYDOWN",
  "KEYUP",
  "KEYPRESS",
  "DRAGDROP",
  "FOCUS",
  "BLUR",
  "SELECT",
  "CHANGE"
]
EventRemoved.forEach(isRemovedFromEvent)

var EventPrototypeRemoved = [
  "getPreventDefault",
  "path"
]
EventPrototypeRemoved.forEach(name => {
  test(() => {
    assert_false(name in Event.prototype)
    assert_equals(Event.prototype[name], undefined)
    assert_false(name in new Event("test"))
    assert_equals((new Event("test"))[name], undefined)
  }, "Event.prototype should not have this property: " + name)
})
</script>