summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/cssom/computed-style-002.html
blob: 7b31c96c098c21576b09941ef819a8df4e3b1e0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<title>CSS Test: getComputedStyle - resolved width in iframe</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"></iframe>
<script>
  test(() => {
    const frmDoc = frm.contentWindow.document;
    frmDoc.open();
    frmDoc.write('<body style="margin:0"><div style="width:100%"></div>');
    frmDoc.close();

    assert_equals(frm.contentWindow.getComputedStyle(frmDoc.querySelector("div")).width, "100px");
  }, "Check that a percent width in an iframe is resolved against iframe width for getComputedStyle.");
</script>