computed-style-003.html (916B)
1 <!DOCTYPE html> 2 <title>CSS Test: getComputedStyle - resolved width in iframe dynamic display</title> 3 <link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org" /> 4 <link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values" /> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <iframe id="frm" width="100" style="display:none"></iframe> 8 <script> 9 const frmDoc = frm.contentWindow.document; 10 frmDoc.open(); 11 frmDoc.write('<body style="margin:0"><div style="width:100%"></div>'); 12 frmDoc.close(); 13 14 document.body.offsetWidth; // Make sure we layout the top document. 15 16 test(() => { 17 frm.style.display = "inline"; 18 assert_equals(frm.contentWindow.getComputedStyle(frmDoc.querySelector("div")).width, "100px"); 19 }, "Check that a percent width in an iframe is the resolved width when the iframe is displayed."); 20 </script>