iframe-loading-lazy-in-scroller.html (884B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://html.spec.whatwg.org/#lazy-load-root-margin"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 6 <style> 7 #scroller { 8 width: 100px; 9 height: 100px; 10 overflow: scroll; 11 background-color: gray; 12 } 13 14 #spacer { 15 width: 100px; 16 height: 100px; 17 } 18 19 #target { 20 width: 100px; 21 height: 100px; 22 } 23 </style> 24 25 <div id="scroller"> 26 <div id="spacer"></div> 27 <iframe 28 id="target" 29 src="resources/subframe.html" 30 loading="lazy" 31 onload="iframe_onload();" 32 ></iframe> 33 </div> 34 35 <script> 36 const t = async_test( 37 "Test that lazy-loaded iframes load when near viewport." 38 ); 39 40 function iframe_onload() { 41 t.done(); 42 } 43 44 t.step_timeout(() => { 45 t.unreached_func( 46 "Timed out while waiting for iframe to load." 47 )(); 48 }, 2000); 49 </script>