summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/srcset/avoid-reload-on-resize.html
blob: 52366dcaa7f7638b27adabe1b1007c5baca98580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<title>Avoid srcset image reloads when viewport resizes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({single_test:true});
const image_was_loaded = () => {
  const iframe = document.getElementById("iframe");
  // Resize the iframe
  iframe.width="400";
  // Wait 500 ms
  step_timeout(() => {
    // Check that the iframe only loaded a single resource
    const entries = iframe.contentWindow.performance.getEntriesByType("resource");
    assert_equals(entries.length, 1);
    done();
  }, 500);
}
</script>
<iframe id=iframe width="401" src="resources/resized.html" onload="image_was_loaded()"></iframe>