OLD | NEW |
1 <script src="../../resources/testharness.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
2 <script src="../../resources/testharnessreport.js"></script> | 2 <script src="../../resources/testharnessreport.js"></script> |
3 <style> | 3 <style> |
4 #t1 { color: 008000 } | 4 #t1 { color: 008000 } |
5 #t2 { background-color: 008000 } | 5 #t2 { background-color: 008000 } |
6 #t3 { border-color: 008000 } | 6 #t3 { border-color: 008000 } |
7 #t4 { border-bottom-color: 008000 } | 7 #t4 { border-bottom-color: 008000 } |
8 #t5 { border-left-color: 008000 } | 8 #t5 { border-left-color: 008000 } |
9 #t6 { border-right-color: 008000 } | 9 #t6 { border-right-color: 008000 } |
10 #t7 { border-top-color: 008000 } | 10 #t7 { border-top-color: 008000 } |
(...skipping 25 matching lines...) Expand all Loading... |
36 #t27 { border-right: ff0000 } | 36 #t27 { border-right: ff0000 } |
37 #t28 { border-bottom: ff0000 } | 37 #t28 { border-bottom: ff0000 } |
38 #t29 { border: ff0000 } | 38 #t29 { border: ff0000 } |
39 | 39 |
40 #t30 { background-color: 1.1 } | 40 #t30 { background-color: 1.1 } |
41 #t31 { background-color: +1.1 } | 41 #t31 { background-color: +1.1 } |
42 #t32 { background-color: 1e1 } | 42 #t32 { background-color: 1e1 } |
43 #t33 { background-color: 1e+1 } | 43 #t33 { background-color: 1e+1 } |
44 #t34 { background-color: 1e-1 } | 44 #t34 { background-color: 1e-1 } |
45 #t35 { background-color: 2222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
2222222222222222222222222f } | 45 #t35 { background-color: 2222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222
2222222222222222222222222f } |
| 46 |
| 47 #t36 { border-color: 1010 } |
| 48 #t37 { border-color: 00101010 } |
| 49 #t38 { border-color: ff10 } |
| 50 #t39 { border-color: ff101010 } |
46 </style> | 51 </style> |
| 52 <div></div> |
47 <script> | 53 <script> |
| 54 function testElementWithColorStyle(colorString) { |
| 55 var element = document.querySelector('div'); |
| 56 element.style.color = null; /* Reset any existing color style first. */ |
| 57 element.style.color = colorString; |
| 58 return element; |
| 59 } |
| 60 |
48 var sheet = document.styleSheets[0]; | 61 var sheet = document.styleSheets[0]; |
49 | 62 |
50 test(function(){ assert_true(!!sheet); }, "StyleSheet present"); | 63 test(function(){ assert_true(!!sheet); }, "StyleSheet present"); |
51 test(function(){ assert_equals(sheet.cssRules.length, 35); }, "All rules parsed"
); | 64 test(function(){ assert_equals(sheet.cssRules.length, 39); }, "All rules parsed"
); |
52 | 65 |
53 test(function(){ | 66 test(function(){ |
54 assert_equals(sheet.cssRules[0].style.color, "rgb(0, 128, 0)"); | 67 assert_equals(sheet.cssRules[0].style.color, "rgb(0, 128, 0)"); |
55 }, "Hashless color quirk for color property"); | 68 }, "Hashless color quirk for color property"); |
56 | 69 |
57 test(function(){ | 70 test(function(){ |
58 assert_equals(sheet.cssRules[1].style.backgroundColor, "rgb(0, 128, 0)"); | 71 assert_equals(sheet.cssRules[1].style.backgroundColor, "rgb(0, 128, 0)"); |
59 }, "Hashless color quirk for background-color property"); | 72 }, "Hashless color quirk for background-color property"); |
60 | 73 |
61 test(function(){ | 74 test(function(){ |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 }, "No hashless color quirk for background-color property with invalid hashless
value"); | 196 }, "No hashless color quirk for background-color property with invalid hashless
value"); |
184 | 197 |
185 test(function(){ | 198 test(function(){ |
186 assert_equals(sheet.cssRules[33].style.backgroundColor, ""); | 199 assert_equals(sheet.cssRules[33].style.backgroundColor, ""); |
187 }, "No hashless color quirk for background-color property with invalid hashless
value"); | 200 }, "No hashless color quirk for background-color property with invalid hashless
value"); |
188 | 201 |
189 test(function(){ | 202 test(function(){ |
190 assert_equals(sheet.cssRules[34].style.backgroundColor, ""); | 203 assert_equals(sheet.cssRules[34].style.backgroundColor, ""); |
191 }, "No hashless color quirk for background-color property with invalid hashless
value"); | 204 }, "No hashless color quirk for background-color property with invalid hashless
value"); |
192 | 205 |
| 206 test(function(){ |
| 207 assert_equals(sheet.cssRules[35].style.borderColor, "rgb(0, 16, 16)"); |
| 208 }, "4 digits: 1010 is a valid <quirky-color>"); |
| 209 |
| 210 test(function(){ |
| 211 assert_equals(sheet.cssRules[36].style.borderColor, "rgb(16, 16, 16)"); |
| 212 }, "8 digits: 00101010 is a valid <quirky-color>"); |
| 213 |
| 214 test(function(){ |
| 215 assert_equals(sheet.cssRules[37].style.borderColor, ""); |
| 216 }, "No hashless color quirk for border-color property with 4 digit hex value"); |
| 217 |
| 218 test(function(){ |
| 219 assert_equals(sheet.cssRules[38].style.borderColor, ""); |
| 220 }, "No hashless color quirk for border-color property with 8 digit hex value"); |
| 221 |
| 222 test(function(){ |
| 223 var element = testElementWithColorStyle("f0f"); |
| 224 assert_equals(element.style.color, "rgb(255, 0, 255)"); |
| 225 }, "3 digit hex: f0f should be accepted in quirks-mode"); |
| 226 |
| 227 test(function(){ |
| 228 var element = testElementWithColorStyle("ff00ff"); |
| 229 assert_equals(element.style.color, "rgb(255, 0, 255)"); |
| 230 }, "6 digit hex: ff00ff should be accepted in quirks-mode"); |
| 231 |
| 232 test(function(){ |
| 233 var element = testElementWithColorStyle("F0F0"); |
| 234 assert_equals(element.style.color, ""); |
| 235 }, "4 digit hex: F0F0 must be ignored in quirks-mode"); |
| 236 |
| 237 test(function(){ |
| 238 var element = testElementWithColorStyle("FF00FF00"); |
| 239 assert_equals(element.style.color, ""); |
| 240 }, "8 digit hex: FF00FF00 must be ignored in quirks-mode"); |
193 </script> | 241 </script> |
OLD | NEW |