before-load-001.html (1478B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Transitions Test: Transitioning before load event</title> 6 <meta name="assert" content="Test checks that transitions are run even before the load event fires"> 7 <!-- NOTE: This test covers unspecified behavior and should probably be 8 removed. It this behavior *were* specified, it would probably be 9 specified here: --> 10 <link rel="help" title="5. Transition Events" href="https://drafts.csswg.org/css-transitions/#starting"> 11 <link rel="author" title="Rodney Rehm" href="http://rodneyrehm.de/en/"> 12 13 <script src="/resources/testharness.js" type="text/javascript"></script> 14 <script src="/resources/testharnessreport.js" type="text/javascript"></script> 15 <script src="./support/helper.js" type="text/javascript"></script> 16 17 </head> 18 <body> 19 20 <script> 21 // Make sure a transition can run before the load event fires. 22 23 let loadEventFired = false; 24 window.addEventListener('load', () => { 25 loadEventFired = true; 26 }, false); 27 28 async_test(t => { 29 const div = addDiv(t, { style: 'transition: height .01s linear; ' + 30 'height: 1px' }); 31 getComputedStyle(div).height; 32 div.style.height = '100px'; 33 34 div.addEventListener('transitionrun', t.step_func_done(() => { 35 assert_false( 36 loadEventFired, 37 'load event should not have fired yet' 38 ); 39 document.getElementById('cat').src = ''; 40 })); 41 }); 42 </script> 43 44 <img src="support/cat.png?pipe=trickle(d1)" id="cat"> 45 </body> 46 </html>