|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id= |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug </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 type="text/css" id="style"></style> |
|
11 </head> |
|
12 <body> |
|
13 <pre id="test"> |
|
14 <script type="application/javascript"> |
|
15 |
|
16 var rules = [ |
|
17 { rule: "@-moz-document url(http://www.example.com/) {}" }, |
|
18 { rule: "@-moz-document url('http://www.example.com/') {}" }, |
|
19 { rule: '@-moz-document url("http://www.example.com/") {}' }, |
|
20 { rule: "@-moz-document url-prefix('http://www.example.com/') {}" }, |
|
21 { rule: '@-moz-document url-prefix("http://www.example.com/") {}' }, |
|
22 { rule: "@-moz-document domain('example.com') {}" }, |
|
23 { rule: '@-moz-document domain("example.com") {}' }, |
|
24 { rule: "@-moz-document regexp('http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/') {}" }, |
|
25 { rule: '@-moz-document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") {}' }, |
|
26 ]; |
|
27 |
|
28 var style = document.getElementById("style"); |
|
29 var style_text = document.createTextNode(""); |
|
30 style.appendChild(style_text); |
|
31 |
|
32 for (var i in rules) { |
|
33 var obj = rules[i]; |
|
34 var rule = obj.rule; |
|
35 |
|
36 style_text.data = rule; |
|
37 is(style.sheet.cssRules.length, 1, "should have one rule"); |
|
38 var ser1 = style.sheet.cssRules[0].cssText; |
|
39 if ("is_canonical" in obj) { |
|
40 is(ser1, rule, "rule '" + rule + "' should serialize to itself"); |
|
41 } |
|
42 |
|
43 style_text.data = ser1; |
|
44 is(style.sheet.cssRules.length, 1, "should have one rule"); |
|
45 var ser2 = style.sheet.cssRules[0].cssText; |
|
46 is(ser2, ser1, |
|
47 "parse+serialize for rule '" + rule + "' should be idempotent"); |
|
48 } |
|
49 |
|
50 </script> |
|
51 </pre> |
|
52 </body> |
|
53 </html> |