4 <style type=
"text/css">
9 background-color: blue
;
12 -webkit-animation: test
10s linear
;
13 animation: test
10s linear
;
15 @
-webkit-keyframes test
{
24 <script type=
"text/javascript">
25 if (window
.testRunner
) {
26 testRunner
.dumpAsText();
27 testRunner
.waitUntilDone();
30 function log(message
) {
31 var div
= document
.createElement('div');
32 div
.textContent
= message
;
33 document
.getElementById('log').appendChild(div
);
38 target
= document
.getElementById('target');
39 target
.addEventListener('webkitAnimationStart', onStart
);
40 target
.classList
.add('animated');
44 log('INFO: Start event fired');
45 target
.removeEventListener('webkitAnimationStart', onStart
);
46 target
.addEventListener('webkitAnimationStart', onRestart
);
47 setTimeout(setDisplay
.bind(null, 0), 20);
50 function checkLeftValue(previousValue
, isLast
) {
51 var currentValue
= getComputedStyle(target
).left
;
52 var pass
= parseFloat(previousValue
) <= parseFloat(currentValue
);
53 log((pass
? 'PASS' : 'FAIL') + ': Left property was ' + (pass
? 'not ' : '') + 'reset' +
54 (pass
? '' : ' (saw change from ' + previousValue
+ ' to ' + currentValue
+ ')'));
55 if (isLast
&& window
.testRunner
) {
56 testRunner
.notifyDone();
77 function setDisplay(index
) {
78 log('INFO: Setting display to ' + values
[index
]);
79 var isLast
= index
=== values
.length
- 1;
80 setTimeout(checkLeftValue
.bind(null, getComputedStyle(target
).left
, isLast
), 0);
81 target
.style
.display
= values
[index
];
83 setTimeout(setDisplay
.bind(null, index
+ 1, true), 20);
87 function onRestart(e
) {
88 // Clear log to avoid flakiness in failure output.
89 document
.getElementById('log').innerHTML
= '';
90 log('FAIL: Start event fired again');
91 if (window
.testRunner
) {
92 testRunner
.notifyDone();
99 Tests that changing the display property of a running animation to a value
100 other than 'none' does not cause it to terminate or re-start.
102 <div id=
"target">target
</div>