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