image-loading-lazy-move-into-script-disabled-iframe.html (1018B)
1 <!DOCTYPE html> 2 <head> 3 <title>A loading='lazy' image starts loading when the element is moved into 4 an iframe where script is disabled</title> 5 <link rel="help" href="https://github.com/scott-little/lazyload"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 10 <div style="height:1000vh;"></div> 11 <iframe id="iframe" src="resources/image-loading-lazy-in-viewport.html"> 12 </iframe> 13 <iframe id="sandboxediframe" sandbox="allow-same-origin"> 14 </iframe> 15 <script> 16 promise_test(async t => { 17 await new Promise(resolve => window.addEventListener('load', resolve)); 18 19 const image = iframe.contentDocument.querySelector("img"); 20 21 assert_false(image.complete, "lazy-load image shouldn't be loaded"); 22 23 sandboxediframe.contentDocument.body.appendChild(image); 24 await new Promise(resolve => image.addEventListener("load", resolve)); 25 26 assert_true(image.complete, 27 "lazy-load image shouldn't be honored in script disabled iframe"); 28 }); 29 </script>