forked from adobe/webkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
supports.html
183 lines (146 loc) · 4.66 KB
/
supports.html
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
<!DOCTYPE HTML>
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
<style>
.test {
content: "UNTOUCHED";
}
@supports (display: none) {
#t0 { content: "APPLIED" }
}
@supports (display: deadbeef) {
#t1 { content: "FAIL" }
}
/* Negation */
@supports not (display: deadbeef) {
#t2 { content: "APPLIED" }
}
@supports not (display: none) {
#t3 { content: "FAIL" }
}
@supports not (not (display: none)) {
#t4 { content: "APPLIED" }
}
@supports not (not (not (display: none))) {
#t5 { content: "FAIL" }
}
/* Conjunction */
@supports (display: none) and (display: block) {
#t6 { content: "APPLIED" }
}
@supports (display: none) and (display: block) and (display: inline) {
#t7 { content: "APPLIED" }
}
@supports (display: none) and (display: block) and (display: deadbeef) and (display: inline) {
#t8 { content: "FAIL" }
}
/* Disjunction */
@supports (display: none) or (display: inline) {
#t9 { content: "APPLIED" }
}
@supports (display: none) or (display: block) or (display: inline) {
#t10 { content: "APPLIED" }
}
@supports (display: none) or (display: deadbeef) or (display: inline) {
#t11 { content: "APPLIED" }
}
@supports (display: ohhai) or (display: deadbeef) or (display: rainbows) {
#t12 { content: "FAIL" }
}
/* Bad syntax. Can't mix operators without a layer of parentheses. */
@supports (display: none) and (display: block) or (display: inline) {
#t13 { content: "FAIL" }
}
@supports not (display: deadbeef) and (display: block) {
#t14 { content: "FAIL" }
}
/* Mix 'n match */
@supports (not (border: 1px 1px 1px 1px 1px solid #000)) and (display: block) {
#t15 { content: "APPLIED" }
}
@supports (display: block !important) and ((display: inline) or (display: deadbeef)){
#t16 { content: "APPLIED" }
}
@supports not ((not (display: block)) or ((display: none) and (deadbeef: 1px))) {
#t17 { content: "APPLIED" }
}
/* Nesting. */
@supports (display: none) {
@supports (display: deadbeef) {
#t18 { content: "FAIL" }
}
@supports (display: inline) {
#t19 { content: "APPLIED" }
}
@supports (display: inline) {
}
@media all {
#t20 { content: "APPLIED" }
@supports (display: inline) {
#t21 { content: "APPLIED" }
}
}
}
/* Whitespace/Syntax */
@supports not( display: deadbeef) {
#t22 { content: "APPLIED" }
}
@supports (display: none)and ( -webkit-transition: all 1s ) {
#t23 { content: "APPLIED" }
}
@supports (display: none)or(-webkit-transition: all 1s) {
#t24 { content: "APPLIED" }
}
@supports (display: none) or(-webkit-transition: all 1s ) {
#t25 { content: "APPLIED" }
}
@supports (((((((display: none))))))) {
#t26 { content: "APPLIED" }
}
@supports(((((((display: none))))))) {
#t27 { content: "APPLIED" }
}
@supports (!important) {
#t28 { content: "FAIL" }
}
@supports not not not not (display: none) {
#t29 { content: "FAIL" }
}
/* Functions */
@supports (top: -webkit-calc(80% - 20px)) {
#t30 { content: "APPLIED" }
}
@supports (background-color: rgb(0, 128, 0)) {
#t31 { content: "APPLIED" }
}
@supports (background: url("/blah")) {
#t32 { content: "APPLIED" }
}
@supports ((top: -webkit-calc(80% - 20px)) and (not (background-color: rgb(0, 128, 0)))) or (background: url("/blah")) {
#t33 { content: "APPLIED" }
}
@supports (background: invalid("/blah")) {
#t34 { content: "FAIL" }
}
</style>
</head>
<body>
<div id="test_container"></div>
<script>
description("Test the @supports rule.");
var numTests = 35;
var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34]; // Tests whose content shouldn't change from the UNTOUCHED default.
var container = document.getElementById("test_container");
for (var i=0; i < numTests; i++) {
var div = document.createElement("div");
div.id = "t" + i;
div.className = "test";
container.appendChild(div);
shouldBeEqualToString("getComputedStyle(document.getElementById('t"+i+"')).content", untouchedTests.indexOf(i) >= 0 ? "UNTOUCHED" : "APPLIED");
}
test_container.parentNode.removeChild(test_container);
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>