summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/historical.html
blob: cec309308649c605340abe91ee0b1fb6e1bc9ec1 (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
<!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 isInterfaceNuked(name) {
  test(function() {
    assert_equals(window[name], undefined)
  }, "Historical DOM features must be removed: " + name)
}
var nukedInterfaces = [
  "DOMConfiguration",
  "DOMError",
  "DOMErrorHandler",
  "DOMImplementationList",
  "DOMImplementationSource",
  "DOMLocator",
  "DOMObject",
  "DOMSettableTokenList",
  "DOMUserData",
  "Entity",
  "EntityReference",
  "EventException", // DOM Events
  "NameList",
  "Notation",
  "TypeInfo",
  "UserDataHandler",
  "RangeException" // DOM Range
]
nukedInterfaces.forEach(isInterfaceNuked)

function isNukedFromDocument(name) {
  test(function() {
    var doc = document.implementation.createDocument(null,null,null)
    assert_equals(document[name], undefined)
    assert_equals(doc[name], undefined)
  }, "Historical DOM features must be removed: " + name)
}
var documentNuked = [
  "createEntityReference",
  "xmlEncoding",
  "xmlStandalone",
  "xmlVersion",
  "strictErrorChecking",
  "domConfig",
  "normalizeDocument",
  "renameNode",
  "defaultCharset",
  "height",
  "width"
]
documentNuked.forEach(isNukedFromDocument)

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

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

function isNukedFromDoctype(name) {
  test(function() {
    var doctype = document.implementation.createDocumentType("test", "", "")
    assert_equals(doctype[name], undefined)
  }, "DocumentType member must be nuked: " + name)
}
var doctypeNuked = [
  "entities",
  "notations",
  "internalSubset"
]
doctypeNuked.forEach(isNukedFromDoctype)

function isNukedFromText(name) {
  test(function() {
    var text = document.createTextNode("test")
    assert_equals(text[name], undefined)
  }, "Text member must be nuked: " + name)
}
var textNuked = [
  "isElementContentWhitespace",
  "replaceWholeText"
]
textNuked.forEach(isNukedFromText)

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

function isNukedFromWindow(name) {
  test(function() {
    assert_equals(window[name], undefined)
  }, "Window member must be nuked: " + name)
}
var windowNuked = [
  "attachEvent"
]
windowNuked.forEach(isNukedFromWindow)
</script>