servo/tests/wpt/css-tests/css-animations-1_dev/html/animationstart-and-animationend-events.htm

127 lines
No EOL
6 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS3 Animations: To verify animationstart and animationend events are handled. </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-name-property">
<link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-duration-property">
<link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-events">
<link rel="help" href="http://www.w3.org/TR/css3-animations/#timing-functions">
<link rel="author" title="Nokia Inc." href="http://www.nokia.com/">
<meta name="flags" content="animated">
<meta name="assert" content='To verify if "animationstart" event occurs when animation starts and "animationend" occurs when the animation ends.'>
<style type="text/css" media="screen">
/* */
@-webkit-keyframes sample {
from {
left: 150px;
}
to {
left: 0px;
}
}
@-moz-keyframes sample {
from {
left: 150px;
}
to {
left: 0px;
}
}
@keyframes sample {
from {
left: 150px;
}
to {
left: 0px;
}
}
.abc {
background-color: blue;
/*Added extra style information --- BEGIN modification*/
color: Yellow;
font-weight: bolder;
font-size: xx-large;
text-align: center;
vertical-align: middle;
/*Added extra style information --- END modification*/
width: 100px;
height: 100px;
padding: 0.2em 1em;
//margin: 6em;
position: relative;
-webkit-animation-name: sample;
//-webkit-animation-delay: 0.1s;
-webkit-animation-duration: 10s;
-webkit-animation-timing-function: linear;
-moz-animation-name: sample;
//-moz-animation-delay: 0.1s;
-moz-animation-duration: 10s;
-moz-animation-timing-function: linear;
animation-name: sample;
//animation-delay: 0.1s;
animation-duration: 10s;
animation-timing-function: linear;
}
/* */
</style>
<script type="text/javascript">
/* */
var box_var;
function init()
{
getvalues();
}
function getvalues()
{
box_var=document.getElementById('box');
box_var.addEventListener('webkitAnimationStart',start_f,true);
box_var.addEventListener('webkitAnimationEnd',end_f,true);
box_var.addEventListener('animationstart',start_f,true);
box_var.addEventListener('animationend',end_f,true);
<!--box_var.addEventListener('webkitAnimationEnd',start_f,true);-->
}
function start_f()
{
/*This line of code has been commented to avoid automated result evaluation.
*document.getElementById('result').innerHTML="TRUE";
*/
document.getElementById('box').innerHTML = "START";
}
function end_f()
{
/*This line of code has been commented to avoid automated result evaluation.
*document.getElementById('result1').innerHTML="TRUE";
*/
document.getElementById('box').innerHTML = "STOP";
}
/* */
</script>
</head>
<body onload="init()">
<p id="testdetails">
<p>
Assertion: To verify if "animationstart" event occurs when animation starts and "animationend" occurs when the animation ends.
</p>
<ul>
<li>PASS if blue box is rendered with text START as the animation begins and changes to STOP when animation is finished. </li>
<li>FAIL if text "FAIL" is displayed OR START is NOT rendered when animation begins OR STOP is NOT rendered when animation ends.</li>
</ul>
</p>
<div class="abc" id="box">
FAIL
</div>
<!-- below markup is removed to avoid inline display of results.
* <p><b>Animation Event Start Value:</b> <span id="result"></span></p>
* <p><b>Animation Event End Value:</b> <span id="result1"></span></p>
-->
</body>
</html>