tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

remove-element-and-scroll.html (1250B)


      1 <!DOCTYPE html>
      2 <head>
      3  <title>Images with loading='lazy' load being removed and then scrolled to</title>
      4  <script src="/resources/testharness.js"></script>
      5  <script src="/resources/testharnessreport.js"></script>
      6  <script src="common.js"></script>
      7 </head>
      8 
      9 <body>
     10  <img id="in_viewport" src='resources/image.png?in_viewport&pipe=trickle(d1)'>
     11  <div style="height:1000vh"></div>
     12  <div id="below_viewport_div"></div>
     13  <img id="below_viewport" src='resources/image.png?below_viewport' loading="lazy">
     14 
     15  <script>
     16    const in_viewport_element = document.getElementById("in_viewport");
     17    const below_viewport_element = document.getElementById("below_viewport");
     18    const below_viewport_div = document.getElementById("below_viewport_div");
     19 
     20    async_test(t => {
     21      below_viewport_element.onload = t.unreached_func("Removed loading=lazy image " +
     22        "should not load when its old position is scrolled to.");
     23      below_viewport_element.remove();
     24 
     25      in_viewport_element.onload = () => {
     26        below_viewport_div.scrollIntoView();
     27        t.step_timeout(t.step_func_done(), 2000);
     28      };
     29    }, "Test that <img> below viewport is not loaded when removed from the " +
     30       "document and then scrolled to");
     31  </script>
     32 </body>