blob: e73b793b8f3c4d98ca188bd029c40e94dc68df21 [file] [log] [blame]
<!DOCTYPE html>
<title>CSS Test: getComputedStyle - resolved width in iframe dynamic display</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="frm" width="100" style="display:none"></iframe>
<script>
const frmDoc = frm.contentWindow.document;
frmDoc.open();
frmDoc.write('<body style="margin:0"><div style="width:100%"></div>');
frmDoc.close();
document.body.offsetWidth; // Make sure we layout the top document.
test(() => {
frm.style.display = "inline";
assert_equals(frm.contentWindow.getComputedStyle(frmDoc.querySelector("div")).width, "100px");
}, "Check that a percent width in an iframe is the resolved width when the iframe is displayed.");
</script>