Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!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>