computed-style-002.html (785B)
1 <!DOCTYPE html> 2 <title>CSS Test: getComputedStyle - resolved width in iframe</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"></iframe> 8 <script> 9 test(() => { 10 const frmDoc = frm.contentWindow.document; 11 frmDoc.open(); 12 frmDoc.write('<body style="margin:0"><div style="width:100%"></div>'); 13 frmDoc.close(); 14 15 assert_equals(frm.contentWindow.getComputedStyle(frmDoc.querySelector("div")).width, "100px"); 16 }, "Check that a percent width in an iframe is resolved against iframe width for getComputedStyle."); 17 </script>