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>Interrupt Transition and Change Its Duration to Zero
</title>
8 <style type=
"text/css" media=
"screen">
13 background-color: blue;
14 -webkit-transition-property: left;
15 -webkit-transition-duration:
2s;
16 -webkit-transition-timing-function: linear;
19 <script type=
"text/javascript" charset=
"utf-8">
20 if (window.layoutTestController) {
21 layoutTestController.dumpAsText();
22 layoutTestController.waitUntilDone();
27 function isEqual(actual, desired, tolerance)
29 var diff = Math.abs(actual - desired);
30 return diff <= tolerance;
33 function snapshot(expected, tolerance)
38 var left = parseInt(window.getComputedStyle(document.getElementById('box')).left);
39 if (!isEqual(left, expected, tolerance))
40 result =
"FAIL(was:"+left+
", expected:"+expected+
")";
45 document.getElementById('box').style.webkitTransitionDuration =
"0s";
46 document.getElementById('box').style.left =
"0px";
49 function startTransition()
51 document.getElementById('box').style.left =
"400px";
56 setTimeout(
"startTransition()",
0);
57 setTimeout(
"snapshot(100, 80)",
500);
58 setTimeout(
"reset()",
600);
59 setTimeout(
"snapshot(0, 0)",
700);
61 window.setTimeout(function() {
62 document.getElementById('result').innerHTML = result;
63 if (window.layoutTestController)
64 layoutTestController.notifyDone();
68 window.addEventListener('load', start, false)
74 This tests changing a transitioning property while running and resetting its duration to
0.
75 The box should start moving left and after
500ms snap back to
0</p>