Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-generated-content.html - WPT Dashboard Interop Dashboard
<!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>