Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / css3 / supports.html
blobdd02fac19b537f5fcd7b0969c67fc66a9526dd45
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <style>
6 .test {
7 content: "UNTOUCHED";
10 @supports (display: none) {
11 #t0 { content: "APPLIED" }
14 @supports (display: deadbeef) {
15 #t1 { content: "FAIL" }
18 /* Negation */
19 @supports not (display: deadbeef) {
20 #t2 { content: "APPLIED" }
23 @supports not (display: none) {
24 #t3 { content: "FAIL" }
27 @supports not (not (display: none)) {
28 #t4 { content: "APPLIED" }
31 @supports not (not (not (display: none))) {
32 #t5 { content: "FAIL" }
35 /* Conjunction */
36 @supports (display: none) and (display: block) {
37 #t6 { content: "APPLIED" }
40 @supports (display: none) and (display: block) and (display: inline) {
41 #t7 { content: "APPLIED" }
44 @supports (display: none) and (display: block) and (display: deadbeef) and (display: inline) {
45 #t8 { content: "FAIL" }
48 /* Disjunction */
49 @supports (display: none) or (display: inline) {
50 #t9 { content: "APPLIED" }
53 @supports (display: none) or (display: block) or (display: inline) {
54 #t10 { content: "APPLIED" }
57 @supports (display: none) or (display: deadbeef) or (display: inline) {
58 #t11 { content: "APPLIED" }
61 @supports (display: ohhai) or (display: deadbeef) or (display: rainbows) {
62 #t12 { content: "FAIL" }
65 /* Bad syntax. Can't mix operators without a layer of parentheses. */
66 @supports (display: none) and (display: block) or (display: inline) {
67 #t13 { content: "FAIL" }
70 @supports not (display: deadbeef) and (display: block) {
71 #t14 { content: "FAIL" }
74 /* Mix 'n match */
75 @supports (not (border: 1px 1px 1px 1px 1px solid #000)) and (display: block) {
76 #t15 { content: "APPLIED" }
79 @supports (display: block !important) and ((display: inline) or (display: deadbeef)){
80 #t16 { content: "APPLIED" }
83 @supports not ((not (display: block)) or ((display: none) and (deadbeef: 1px))) {
84 #t17 { content: "APPLIED" }
87 /* Whitespace/Syntax */
88 @supports not( display: deadbeef) {
89 #t22 { content: "FAIL" }
92 @supports (display: none)and ( -webkit-transition: all 1s ) {
93 #t23 { content: "FAIL" }
96 @supports (display: none)or(-webkit-transition: all 1s) {
97 #t24 { content: "FAIL" }
100 @supports (display: none) or(-webkit-transition: all 1s ) {
101 #t25 { content: "FAIL" }
104 @supports (((((((display: none))))))) {
105 #t26 { content: "APPLIED" }
108 @supports(((((((display: none))))))) {
109 #t27 { content: "APPLIED" }
112 @supports (!important) {
113 #t28 { content: "FAIL" }
116 @supports not not not not (display: none) {
117 #t29 { content: "FAIL" }
120 /* Functions */
122 @supports (top: -webkit-calc(80% - 20px)) {
123 #t30 { content: "APPLIED" }
126 @supports (background-color: rgb(0, 128, 0)) {
127 #t31 { content: "APPLIED" }
130 @supports (background: url("/blah")) {
131 #t32 { content: "APPLIED" }
134 @supports ((top: -webkit-calc(80% - 20px)) and (not (background-color: rgb(0, 128, 0)))) or (background: url("/blah")) {
135 #t33 { content: "APPLIED" }
138 @supports (background: invalid("/blah")) {
139 #t34 { content: "FAIL" }
142 /* Nesting. */
143 @supports (display: none) {
144 @supports (display: deadbeef) {
145 #t18 { content: "FAIL" }
147 @supports (display: inline) {
148 #t19 { content: "APPLIED" }
150 @supports (display: inline) {
152 @media all {
153 #t20 { content: "APPLIED" }
154 @supports (display: inline) {
155 #t21 { content: "APPLIED" }
160 @media all {
161 @supports (display: inline) {
162 @media all {
163 @supports (display: none) {
164 #t35 { content: "APPLIED" }
170 @media not all {
171 @supports (display: none) {
172 #t36 { content: "FAIL" }
176 /* Invalid syntax error recovery */
178 @supports (display: none);
179 @supports (display: none) and ( (display: none) ) {
180 #t37 { content: "APPLIED" }
183 @supports (display: none)) ;
184 @supports (display: none) {
185 #t38 { content: "APPLIED" }
188 @supports;
189 @supports (display: none) {
190 #t39 { content: "APPLIED" }
193 @supports ;
194 @supports (display: none) {
195 #t40 { content: "APPLIED" }
198 @supports (display: none)) {
199 #t41 { content: "FAIL" }
201 @supports (display: none) {
202 #t41 { content: "APPLIED" }
205 @supports (display: )) {
206 #t42 { content: "FAIL" }
208 @supports (display: none) {
209 #t42 { content: "APPLIED" }
212 @supports ((display: none) and {
213 #t43 { content: "FAIL" }
215 @supports (display: none) {
216 #t43 { content: "FAIL" }
220 @supports ((display: none) and ;
221 @supports (display: none) {
222 #t44 { content: "FAIL" }
226 @supports (#(display: none) {}
227 #t45 { content: "FAIL" }
230 @supports ((display: none#) {}
231 #t46 { content: "FAIL" }
234 @supports (#) or (display: none) {
235 #t47 { content: "APPLIED"; }
238 </style>
239 </head>
240 <body>
241 <div id="test_container"></div>
243 <script>
244 description("Test the @supports rule.");
245 var numTests = 48;
246 var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 22, 23, 24, 25, 28, 29, 34, 36, 43, 44, 45, 46]; // Tests whose content shouldn't change from the UNTOUCHED default.
248 var container = document.getElementById("test_container");
249 for (var i=0; i < numTests; i++) {
250 var div = document.createElement("div");
251 div.id = "t" + i;
252 div.className = "test";
253 container.appendChild(div);
254 shouldBeEqualToString("getComputedStyle(document.getElementById('t"+i+"')).content", untouchedTests.indexOf(i) >= 0 ? '"UNTOUCHED"' : '"APPLIED"');
257 test_container.parentNode.removeChild(test_container);
258 </script>
259 </body>
260 </html>