summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-slow-aspect-ratio.html
blob: 662ada69095c5079924008ad2a252fdaa474267e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html class="reftest-wait">
  <link rel="match" href="image-loading-lazy-slow-aspect-ratio-ref.html">
  <link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org">
  <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-img-element">
  <script src="/common/reftest-wait.js"></script>
  <img id=target loading="lazy"
      width="200" height="100" style="width: 100px; height: auto; border: 1px solid black">
<script>
  let loaded = false;
  target.onload = () => {
    if (loaded) return;
    loaded = true;
    target.src = "";
    requestAnimationFrame(() => requestAnimationFrame(() => {
      target.src = "resources/image.png?slow-aspect-ratio&pipe=trickle(d2)";
      takeScreenshot();
    }));
  };
  target.src = "resources/image.png?slow-aspect-ratio";
</script>