4 https://bugzilla.mozilla.org/show_bug.cgi?id=372770
7 <title>Test for Bug
372770</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
10 <style id=
"testStyle">
15 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=372770">Mozilla Bug
372770</a>
17 <div id=
"content" style=
"display: none">
21 <script class=
"testbody" type=
"text/javascript">
23 /** Test for Bug
372770 **/
24 var style1 = $(
"content").style;
25 var style2 = $(
"testStyle").sheet.cssRules[
0].style;
27 var colors = [
"rgb(128, 128, 128)",
"transparent" ]
30 for (i =
0; i < colors.length; ++i) {
31 var color = colors[i];
34 is(style1.color, color,
"Inline style color roundtripping failed at color " + i);
35 is(style2.color, color,
"Rule style color roundtripping failed at color " + i);
38 style1.color =
"rgba(0, 0, 0, 0)";
39 style2.color =
"rgba(0, 0, 0, 0)";
40 is(style1.color,
"rgba(0, 0, 0, 0)",
41 "Inline style should round-trip black transparent color correctly");
42 is(style2.color,
"rgba(0, 0, 0, 0)",
43 "Rule style should round-trip black transparent color correctly");
45 for (var i =
0; i <=
100; ++i) {
46 if (i ==
70 || i ==
90) {
47 // Tinderbox unhappy for some reason... just skip these for now?
50 var color1 =
"rgba(128, 128, 128, " + i/
100 +
")";
51 var color2 =
"rgba(175, 63, 27, " + i/
100 +
")";
52 style1.color = color1;
53 style1.backgroundColor = color2;
54 style2.color = color2;
55 style2.background = color1;
58 // Bug
372783 means this doesn't round-trip quite right
59 todo(style1.color == color1,
60 "Inline style color roundtripping failed at opacity " + i);
61 todo(style1.backgroundColor == color2,
62 "Inline style background roundtripping failed at opacity " + i);
63 todo(style2.color == color2,
64 "Rule style color roundtripping failed at opacity " + i);
65 todo(style2.backgroundColor == color1,
66 "Rule style background roundtripping failed at opacity " + i);
67 color1 =
"rgb(128, 128, 128)";
68 color2 =
"rgb(175, 63, 27)";
71 is(style1.color, color1,
72 "Inline style color roundtripping failed at opacity " + i);
73 is(style1.backgroundColor, color2,
74 "Inline style background roundtripping failed at opacity " + i);
75 is(style2.color, color2,
76 "Rule style color roundtripping failed at opacity " + i);
77 is(style2.backgroundColor, color1,
78 "Rule style background roundtripping failed at opacity " + i);