hidden-attr.html (1378B)
1 <!DOCTYPE html> 2 <title>UA style for hidden attribute on table elements</title> 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#tables-2"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <table hidden></table> 7 <table><caption hidden></caption></table> 8 <table><colgroup hidden></table> 9 <table><col hidden></table> 10 <table><thead hidden></table> 11 <table><tbody hidden></table> 12 <table><tfoot hidden></table> 13 <table><tr hidden></table> 14 <table><tr><td hidden></table> 15 <table><tr><th hidden></table> 16 <script> 17 const expectedDisplay = { 18 'table': 'none', 19 'caption': 'none', 20 'colgroup': 'table-column-group', 21 'col': 'table-column', 22 'thead': 'table-header-group', 23 'tbody': 'table-row-group', 24 'tfoot': 'table-footer-group', 25 'tr': 'table-row', 26 'td': 'none', 27 'th': 'none', 28 }; 29 for (const el of document.querySelectorAll("[hidden]")) { 30 test(function() { 31 const style = getComputedStyle(el); 32 assert_equals(style.display, expectedDisplay[el.localName]); 33 if (el instanceof HTMLTableElement || 34 el instanceof HTMLTableCaptionElement || 35 el instanceof HTMLTableCellElement) { 36 assert_equals(style.visibility, 'visible'); 37 } else { 38 assert_equals(style.visibility, 'collapse'); 39 } 40 }, `Computed display and visibility of ${el.localName}`); 41 } 42 </script>