summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-generated-content.html
blob: 25a36bc42cf8e1626dc91ea281cbc0bd00051c1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!doctype html>
<title>fieldset generated content</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
body {
  /* Use Ahem to avoid fractional letter widths. */
  font: 20px/1 Ahem;
}

fieldset {
  display: inline-block;
  /* Paddings might have fractional values by default, and they can cause
     rounding differences between the test element and the reference element. */
  padding: 0;
}

#test::before, #test::after { content:"X"; }
</style>
<fieldset id=test><legend>A</legend>Y</fieldset>
<fieldset id=ref><legend>A</legend>XYX</fieldset>
<script>
test(() => {
  const testElm = document.querySelector('#test');
  const refElm = document.querySelector('#ref');
  assert_equals(testElm.clientWidth, refElm.clientWidth, 'clientWidth');
  assert_equals(testElm.clientHeight, refElm.clientHeight, 'clientHeight');
});
</script>