New layout tests for the bugs I just fixed.
[WebKit-https.git] / LayoutTests / fast / dom / features.html
1 <script>
2
3 function test() {
4
5     var undefined;
6
7     var features = [
8         ["Core", undefined],
9         ["HTML", undefined],
10         ["XML", undefined],
11         ["Views", undefined],
12         ["StyleSheets", undefined],
13         ["CSS", undefined],
14         ["CSS2", undefined],
15         ["CSS3", undefined],
16         ["Events", undefined],
17         ["UIEvents", undefined],
18         ["MouseEvents", undefined],
19         ["HTMLEvents", undefined],
20         ["MutationEvents", undefined],
21         ["Range", undefined],
22         ["Traversal", undefined],
23
24         ["Core", null],
25         ["HTML", null],
26         ["XML", null],
27         ["Views", null],
28         ["StyleSheets", null],
29         ["CSS", null],
30         ["CSS2", null],
31         ["CSS3", null],
32         ["Events", null],
33         ["UIEvents", null],
34         ["MouseEvents", null],
35         ["HTMLEvents", null],
36         ["MutationEvents", null],
37         ["Range", null],
38         ["Traversal", null],
39
40         ["Core", ""],
41         ["HTML", ""],
42         ["XML", ""],
43         ["Views", ""],
44         ["StyleSheets", ""],
45         ["CSS", ""],
46         ["CSS2", ""],
47         ["CSS3", ""],
48         ["Events", ""],
49         ["UIEvents", ""],
50         ["MouseEvents", ""],
51         ["HTMLEvents", ""],
52         ["MutationEvents", ""],
53         ["Range", ""],
54         ["Traversal", ""],
55
56         ["Core", "1.0"],
57         ["HTML", "1.0"],
58         ["XML", "1.0"],
59         ["Views", "1.0"],
60         ["StyleSheets", "1.0"],
61         ["CSS", "1.0"],
62         ["CSS2", "1.0"],
63         ["CSS3", "1.0"],
64         ["Events", "1.0"],
65         ["UIEvents", "1.0"],
66         ["MouseEvents", "1.0"],
67         ["HTMLEvents", "1.0"],
68         ["MutationEvents", "1.0"],
69         ["Range", "1.0"],
70         ["Traversal", "1.0"],
71
72         ["Core", "2.0"],
73         ["HTML", "2.0"],
74         ["XML", "2.0"],
75         ["Views", "2.0"],
76         ["StyleSheets", "2.0"],
77         ["CSS", "2.0"],
78         ["CSS2", "2.0"],
79         ["CSS3", "2.0"],
80         ["Events", "2.0"],
81         ["UIEvents", "2.0"],
82         ["MouseEvents", "2.0"],
83         ["HTMLEvents", "2.0"],
84         ["MutationEvents", "2.0"],
85         ["Range", "2.0"],
86         ["Traversal", "2.0"],
87
88         ["Core", "3.0"],
89         ["HTML", "3.0"],
90         ["XML", "3.0"],
91         ["Views", "3.0"],
92         ["StyleSheets", "3.0"],
93         ["CSS", "3.0"],
94         ["CSS2", "3.0"],
95         ["CSS3", "3.0"],
96         ["Events", "3.0"],
97         ["UIEvents", "3.0"],
98         ["MouseEvents", "3.0"],
99         ["HTMLEvents", "3.0"],
100         ["MutationEvents", "3.0"],
101         ["Range", "3.0"],
102         ["Traversal", "3.0"],
103
104         ["Core", "nonsense"],
105         ["HTML", "nonsense"],
106         ["XML", "nonsense"],
107         ["Views", "nonsense"],
108         ["StyleSheets", "nonsense"],
109         ["CSS", "nonsense"],
110         ["CSS2", "nonsense"],
111         ["CSS3", "nonsense"],
112         ["Events", "nonsense"],
113         ["UIEvents", "nonsense"],
114         ["MouseEvents", "nonsense"],
115         ["HTMLEvents", "nonsense"],
116         ["MutationEvents", "nonsense"],
117         ["Range", "nonsense"],
118         ["Traversal", "nonsense"],
119
120         [undefined, ""],
121         [undefined, "1.0"],
122         [undefined, "2.0"],
123         [undefined, "3.0"],
124         [undefined, "nonsense"],
125         [undefined, undefined],
126         [undefined, null],
127
128         [null, ""],
129         [null, "1.0"],
130         [null, "2.0"],
131         [null, "3.0"],
132         [null, "nonsense"],
133         [null, undefined],
134         [null, null],
135
136         ["nonsense", ""],
137         ["nonsense", "1.0"],
138         ["nonsense", "2.0"],
139         ["nonsense", "3.0"],
140         ["nonsense", "nonsense"],
141         ["nonsense", undefined],
142         ["nonsense", null],
143     ];
144
145     for (var i = 0; i < features.length; ++i)
146     {
147         var item = features[i];
148         if (item[1] == "omitted") {
149             var hasFeature = document.implementation.hasFeature(item[0]);
150             var isSupported = document.body.isSupported(item[0]);
151         } else {
152             var hasFeature = document.implementation.hasFeature(item[0], item[1]);
153             var isSupported = document.body.isSupported(item[0], item[1]);
154         }
155
156         var item0String = item[0];
157         if (typeof item0String == "string")
158             item0String = '"' + item0String + '"';
159         var item1String = item[1];
160         if (typeof item1String == "string" && item[1] != "omitted")
161             item1String = '"' + item1String + '"';
162         var message = item0String + ', ' + item1String + ': ' + hasFeature + ', ' + isSupported;
163
164         var div = document.createElement('div');
165         div.innerHTML = message;
166         document.body.appendChild(div);
167     }
168 }
169
170 </script>
171
172 <body onload="test()">
173 </body>