OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <meta charset=utf-8> |
3 <title>Canceling an animation: cancel event</title> | |
4 <link rel="help" href="https://w3c.github.io/web-animations/#canceling-an-anima tion-section"> | |
3 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
7 <body> | |
5 <script> | 8 <script> |
6 var anim1 = document.body.animate([], 100000); | 9 var anim1 = document.body.animate([], 100000); |
7 var anim2 = document.body.animate([], 100000); | 10 var anim2 = document.body.animate([], 100000); |
alancutter (OOO until 2018)
2016/07/12 01:45:35
Duration Infinity is probably better.
| |
8 | 11 |
9 var cancelTest = async_test('Cancelling animation should create cancel event.'); | 12 var cancelTest = async_test('Cancelling animation should fire a cancel event.'); |
10 var fired = false; | 13 var fired = false; |
11 | 14 |
12 anim1.oncancel = function(event) { | 15 anim1.oncancel = function(event) { |
13 cancelTest.step(function() { | 16 cancelTest.step(function() { |
14 assert_equals(event.target, anim1, 'Target of cancel event should be anim1.' ); | 17 assert_equals(event.target, anim1, 'Target of cancel event should be anim1.' ); |
15 assert_equals(event.currentTime, null, 'currentTime of cancel event should b e null.'); | 18 assert_equals(event.currentTime, null, 'currentTime of cancel event should b e null.'); |
16 assert_equals(event.timelineTime, document.timeline.currentTime, 'Event time lineTime should be same as document.timeline.currentTime.'); | 19 assert_equals(event.timelineTime, document.timeline.currentTime, 'Event time lineTime should be same as document.timeline.currentTime.'); |
17 }); | 20 }); |
18 fired = true; | 21 fired = true; |
19 }; | 22 }; |
20 | 23 |
21 anim2.onfinish = function() { | 24 anim2.onfinish = function() { |
22 cancelTest.step(function() { | 25 cancelTest.step(function() { |
23 assert_true(fired, 'anim1.oncancel should be called.'); | 26 assert_true(fired, 'anim1.oncancel should be called.'); |
24 }); | 27 }); |
25 cancelTest.done(); | 28 cancelTest.done(); |
26 }; | 29 }; |
27 | 30 |
28 anim1.cancel(); | 31 anim1.cancel(); |
29 anim2.finish(); | 32 anim2.finish(); |
30 </script> | 33 </script> |
31 </body> | |
alancutter (OOO until 2018)
2016/07/12 01:45:35
Why remove the closing tag?
dstockwell
2016/07/12 04:56:07
Closing tag does nothing.
| |
OLD | NEW |