4 https://bugzilla.mozilla.org/show_bug.cgi?id=319381
7 <title>Test for Bug
319381</title>
8 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
9 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=319381">Mozilla Bug
319381</a>
15 <div id=
"content" style=
"display: none">
19 <script class=
"testbody" type=
"text/javascript">
21 /** Test for Bug
319381 **/
24 return document.defaultView.getComputedStyle($('t'),
"").
25 getPropertyValue(
"overflow");
29 return document.defaultView.getComputedStyle($('t'),
"").
30 getPropertyCSSValue(
"overflow");
33 var vals = [
"visible",
"hidden",
"auto",
"scroll"];
34 var mozVals = [
"-moz-scrollbars-vertical",
"-moz-scrollbars-horizontal"];
37 for (i =
0; i < vals.length; ++i) {
38 $('t').style.overflow = vals[i];
39 is($('t').style.overflow, vals[i],
"Roundtrip");
40 is(c(), vals[i],
"Simple property set");
41 isnot(cval(), null,
"Simple property as CSSValue");
44 $('t').style.overflow = mozVals[
0];
45 is($('t').style.getPropertyValue(
"overflow-y"),
"scroll",
"Roundtrip");
46 is($('t').style.getPropertyValue(
"overflow-x"),
"hidden",
"Roundtrip");
47 is($('t').style.overflow,
"",
"Shorthand read directly");
48 is(c(),
"",
"Shorthand computed");
49 is(cval(), null,
"Shorthand as CSSValue");
51 $('t').style.overflow = mozVals[
1];
52 is($('t').style.getPropertyValue(
"overflow-x"),
"scroll",
"Roundtrip");
53 is($('t').style.getPropertyValue(
"overflow-y"),
"hidden",
"Roundtrip");
54 is($('t').style.overflow,
"",
"Shorthand read directly");
55 is(c(),
"",
"Shorthand computed");
56 is(cval(), null,
"Shorthand as CSSValue");
58 for (i =
0; i < vals.length; ++i) {
59 for (j =
0; j < vals.length; ++j) {
60 $('t').setAttribute(
"style",
61 "overflow-x: " + vals[i] +
"; overflow-y: " + vals[j]);
62 is($('t').style.getPropertyValue(
"overflow-x"), vals[i],
"Roundtrip");
63 is($('t').style.getPropertyValue(
"overflow-y"), vals[j],
"Roundtrip");
66 is($('t').style.overflow, vals[i],
"Shorthand serialization");
68 is($('t').style.overflow,
"",
"Shorthand serialization");
71 //
"visible" overflow-x and overflow-y become
"auto" in computed style if
72 // the other direction is not also
"visible".
73 if (i == j || (vals[i] ==
"visible" && vals[j] ==
"auto")) {
74 is(c(), vals[j],
"Shorthand computation");
75 isnot(cval(), null,
"Shorthand computation as CSSValue");
76 } else if (vals[j] ==
"visible" && vals[i] ==
"auto") {
77 is(c(), vals[i],
"Shorthand computation");
78 isnot(cval(), null,
"Shorthand computation as CSSValue");
80 is(c(),
"",
"Shorthand computation");
81 is(cval(), null,
"Shorthand computation as CSSValue");