|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=814907 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 814907</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 <style id="style"> |
|
11 @-moz-document url(http://www.example.com/) {} |
|
12 @-moz-document url('http://www.example.com/') {} |
|
13 @-moz-document url("http://www.example.com/") {} |
|
14 @-moz-document url-prefix('http://www.example.com/') {} |
|
15 @-moz-document url-prefix("http://www.example.com/") {} |
|
16 @-moz-document domain('example.com') {} |
|
17 @-moz-document domain("example.com") {} |
|
18 @-moz-document regexp('http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/') {} |
|
19 @-moz-document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") {} |
|
20 |
|
21 @media all {} |
|
22 @media only color {} |
|
23 @media (color ) {} |
|
24 @media color \0061ND ( monochrome ) {} |
|
25 @media (max-width: 200px), (color) {} |
|
26 |
|
27 @supports(color: green){} |
|
28 @supports (color: green) {} |
|
29 @supports ((color: green)) {} |
|
30 @supports (color: green) and (color: blue) {} |
|
31 @supports ( Font: 20px serif ! Important) {} |
|
32 </style> |
|
33 </head> |
|
34 <body> |
|
35 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=814907">Mozilla Bug 814907</a> |
|
36 <p id="display"></p> |
|
37 <div id="content" style="display: none"> |
|
38 |
|
39 </div> |
|
40 <pre id="test"> |
|
41 <script type="application/javascript"> |
|
42 |
|
43 /** Test for Bug 814907 **/ |
|
44 |
|
45 function runTest() |
|
46 { |
|
47 // re-parse the style sheet with the pref turned on |
|
48 var style = document.getElementById("style"); |
|
49 style.textContent += " "; |
|
50 |
|
51 var sheet = style.sheet; |
|
52 |
|
53 var conditions = [ |
|
54 "url(\"http://www.example.com/\")", |
|
55 "url(\"http://www.example.com/\")", |
|
56 "url(\"http://www.example.com/\")", |
|
57 "url-prefix(\"http://www.example.com/\")", |
|
58 "url-prefix(\"http://www.example.com/\")", |
|
59 "domain(\"example.com\")", |
|
60 "domain(\"example.com\")", |
|
61 "regexp(\"http://www.w3.org/TR/\\\\d{4}/[^/]*-CSS2-\\\\d{8}/\")", |
|
62 "regexp(\"http://www.w3.org/TR/\\\\d{4}/[^/]*-CSS2-\\\\d{8}/\")", |
|
63 "all", |
|
64 "only color", |
|
65 "(color)", |
|
66 "color and (monochrome)", |
|
67 "(max-width: 200px), (color)", |
|
68 "(color: green)", |
|
69 "(color: green)", |
|
70 "((color: green))", |
|
71 "(color: green) and (color: blue)", |
|
72 "( Font: 20px serif ! Important)" |
|
73 ]; |
|
74 |
|
75 is(sheet.cssRules.length, conditions.length); |
|
76 |
|
77 for (var i = 0; i < sheet.cssRules.length; i++) { |
|
78 var rule = sheet.cssRules[i]; |
|
79 is(rule.conditionText, conditions[i], "rule " + i + " has expected conditionText"); |
|
80 if (rule.type == CSSRule.MEDIA_RULE) { |
|
81 is(rule.conditionText, rule.media.mediaText, "rule " + i + " conditionText matches media.mediaText"); |
|
82 } |
|
83 } |
|
84 |
|
85 SimpleTest.finish(); |
|
86 } |
|
87 |
|
88 SimpleTest.waitForExplicitFinish(); |
|
89 SpecialPowers.pushPrefEnv({ "set": [["layout.css.supports-rule.enabled", true]] }, runTest); |
|
90 </script> |
|
91 </pre> |
|
92 </body> |
|
93 </html> |