iframe-loading-lazy-in-scroller-nested.html (1008B)
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 id="scroller"> 33 <div id="spacer"></div> 34 <iframe 35 id="target" 36 src="resources/subframe.html" 37 loading="lazy" 38 onload="iframe_onload();" 39 ></iframe> 40 </div> 41 </div> 42 43 <script> 44 const t = async_test( 45 "Test that lazy-loaded iframes load when near viewport." 46 ); 47 48 function iframe_onload() { 49 t.done(); 50 } 51 52 t.step_timeout(() => { 53 t.unreached_func( 54 "Timed out while waiting for iframe to load." 55 )(); 56 }, 2000); 57 </script>