Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / the-img-element / sizes / sizes-dynamic-001.html
1 <!doctype html>
2 <html class="reftest-wait">
3 <title>Image intrinsic size specified via sizes attribute reacts properly to media changes</title>
4 <link rel="author" title="Emilio Cobos Ãlvarez" href="mailto:emilio@crisal.io">
5 <link rel="match" href="sizes-dynamic-001-ref.html">
6 <link rel="help" href="https://html.spec.whatwg.org/#sizes-attributes">
7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1149357">
8 <script>
9 function frameLoaded(frame) {
10   frame.width = "500";
11   let img = frame.contentDocument.querySelector('img');
12
13   // Trigger the viewport resize, which will trigger the image load task.
14   img.offsetWidth;
15
16   // Wait for the image load task to run.
17   setTimeout(() => document.documentElement.removeAttribute("class"), 0);
18 }
19 </script>
20 <iframe onload="frameLoaded(this)" width="200" height="500" srcdoc='<!doctype html><img srcset="/images/green-256x256.png 100w" style="max-width: 100%" sizes="(min-width: 400px) 10px, 20px">'></iframe>