1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7 <title>Test Changing Name of A Keyframes Rule Using CSSOM</title>
8 <style type="text/css" media="screen">
15 background-color: blue;
16 -webkit-animation-duration: 0.5s;
17 -webkit-animation-timing-function: linear;
18 -webkit-animation-name: "bar";
20 @-webkit-keyframes "foo" {
27 <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
28 <script type="text/javascript" charset="utf-8">
30 const expectedValues = [
31 // [animation-name, time, element-id, property, expected-value, tolerance]
32 [null, 0.25, "box", "left", 200, 20],
35 function findKeyframesRule(rule)
37 var ss = document.styleSheets;
38 for (var i = 0; i < ss.length; ++i) {
39 for (var j = 0; j < ss[i].cssRules.length; ++j) {
40 if (ss[i].cssRules[j].type == window.CSSRule.WEBKIT_KEYFRAMES_RULE && ss[i].cssRules[j].name == rule)
41 return ss[i].cssRules[j];
50 // change keyframes name
51 var keyframes = findKeyframesRule("foo");
52 keyframes.name = "anim";
53 document.getElementById('box').style.webkitAnimationName = "anim";
55 runAnimationTest(expectedValues);
60 if (window.layoutTestController) {
61 layoutTestController.dumpAsText();
62 layoutTestController.waitUntilDone();
63 if (layoutTestController.pauseAnimationAtTimeOnElementWithId("bar", 0.5, "box"))
64 document.getElementById("pre-result").innerHTML = "FAIL: animation is running";
66 document.getElementById("pre-result").innerHTML = "PASS: animation is not running";
69 setTimeout(change, 200);
74 <body onload="setup()">
75 This test starts by making sure the animation is not running, because the animation-name and the
76 name of they @keyframes rule do not match. Then it changes the name of the @keyframes rule so they
77 match and makes sure the animation is now running.