responsive-iframe-dom-content-loaded.tentative.html (1044B)
1 <!doctype HTML> 2 <title>Test that `DOMContentLoaded` triggers resizing.</title> 3 <link rel="author" href="mailto:kojii@chromium.org"> 4 <link rel="help" href="https://drafts.csswg.org/css-sizing/"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 iframe { 9 contain-intrinsic-size: from-element none; 10 } 11 </style> 12 <iframe id="target" frameborder=0 src="resources/iframe-contents-dom-content-loaded.html"></iframe> 13 <script> 14 async_test(t => { 15 window.addEventListener('message', t.step_func(e => { 16 const type = e.data.type; 17 if (type === 'DOMContentLoaded') { 18 // The resize may not be synchronous, so wait for an animation frame. 19 requestAnimationFrame(t.step_func(() => { 20 assert_equals(target.offsetHeight, 200); 21 })); 22 } else if (type === 'load') { 23 requestAnimationFrame(t.step_func(() => { 24 assert_equals(target.offsetHeight, 400); 25 t.done(); 26 })); 27 } 28 })); 29 }, "`DOMContentLoaded` triggers resizing"); 30 </script> 31 </body>