summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/cssom/computed-style-003.html
blob: e73b793b8f3c4d98ca188bd029c40e94dc68df21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!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>