iframe-loading-lazy-in-scroller-nested-4.html (1040B)
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 #scroller2 { 15 width: 110px; 16 height: 110px; 17 overflow: scroll; 18 } 19 20 .spacer { 21 width: 130px; 22 height: 130px; 23 } 24 25 #target { 26 width: 100px; 27 height: 100px; 28 } 29 </style> 30 31 <div id=scroller2> 32 <div class="spacer"></div> 33 <div id="scroller"> 34 <div class="spacer"></div> 35 <iframe 36 id="target" 37 src="resources/subframe.html" 38 loading="lazy" 39 onload="iframe_onload();" 40 ></iframe> 41 </div> 42 </div> 43 44 <script> 45 const t = async_test( 46 "Test that lazy-loaded iframes load when near viewport." 47 ); 48 49 function iframe_onload() { 50 t.done(); 51 } 52 53 t.step_timeout(() => { 54 t.unreached_func( 55 "Timed out while waiting for iframe to load." 56 )(); 57 }, 2000); 58 </script>