4 https://bugzilla.mozilla.org/show_bug.cgi?id=978833
7 <title>Test for Bug
978833</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 /* a non-inherited property, so it's cached in the rule tree */
18 animation: a linear
1s infinite;
23 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=978833">Mozilla Bug
978833</a>
26 <script type=
"application/javascript">
28 var p = document.getElementById(
"display");
29 var cs = getComputedStyle(p,
"");
30 var style = document.getElementById(
"style").sheet;
32 /** Test for Bug
978833 **/
33 function test_bug978833() {
34 var kfs = style.cssRules[
0];
35 var kf = kfs.cssRules[
0];
36 is(kf.style.marginLeft,
"50px",
"we found the right keyframe rule");
38 p.classList.add(
"alwaysa");
39 is(cs.marginLeft,
"50px",
"p margin-left should be 50px");
41 // Temporarily remove the animation style, since we resolve keyframes
42 // on top of current animation styles (although maybe we shouldn't),
43 // so we need to remove those styles to hit the rule tree cache.
44 p.classList.remove(
"alwaysa");
45 is(cs.marginLeft,
"0px",
"p margin-left should be 0px without animation");
47 p.classList.add(
"alwaysa");
48 kf.style.marginLeft =
"100px";
49 is(cs.marginLeft,
"100px",
"p margin-left should be 100px after change");
51 // Try the same thing a second time, just to make sure it works again.
52 p.classList.remove(
"alwaysa");
53 is(cs.marginLeft,
"0px",
"p margin-left should be 0px without animation");
54 p.classList.add(
"alwaysa");
55 kf.style.marginLeft =
"150px";
56 is(cs.marginLeft,
"150px",
"p margin-left should be 150px after second change");
58 p.style.animation =
"";