bounding-box-computation-3.html (3139B)
1 <!doctype html> 2 <script src='/resources/testharness.js'></script> 3 <script src='/resources/testharnessreport.js'></script> 4 <link rel='stylesheet' href='./support/base.css' /> 5 <link rel="help" href="https://drafts.csswg.org/css-tables-3/#bounding-box-assignment"> 6 <main> 7 8 <h1>Bounding box computation</h1> 9 <p>Checks that all table-internal boxes are positioned correctly</p> 10 11 <hr/> 12 <p>The first table-row-group should have width and height 0:</p> 13 <p>The first tbody is empty, and should return an height of 0px. The second one should be 100px tall.</p> 14 <x-table style="border-spacing: 10px; background: yellow; position: relative;"> 15 <x-tbody></x-tbody> 16 <x-tbody> 17 <x-tr> 18 <x-td style="padding: 50px; background: blue;"></x-td> 19 </x-tr> 20 </x-tbody> 21 </x-table> 22 23 </main> 24 25 <script> 26 while(true) { 27 var xtd = document.querySelector('x-td[rowspan], x-td[colspan]'); if(!xtd) break; 28 var td = document.createElement('td'); for(var i = xtd.attributes.length; i--;) { td.setAttribute(xtd.attributes[i].name,xtd.attributes[i].value) } 29 xtd.parentNode.replaceChild(td,xtd); 30 } 31 32 var i = 1; 33 generate_tests(assert_equals, [ 34 [ 35 "Control test: Table width is 120px", 36 document.querySelector("x-table:nth-of-type("+(i++)+")").offsetWidth, 37 120 38 ], 39 [ 40 "Control test: Table height is 120px", 41 document.querySelector("x-table:nth-of-type("+(i-1)+")").offsetHeight, 42 120 43 ], 44 [ 45 "First (empty) table-row-group is 0px wide", 46 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetWidth, 47 0 48 ], 49 [ 50 "First (empty) table-row-group is 0px tall", 51 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetHeight, 52 0 53 ], 54 [ 55 "First (empty) table-row-group should be located at 10px left", 56 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetLeft, 57 10 58 ], 59 [ 60 "First (empty) table-row-group should be located at 10px top", 61 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetTop, 62 10 63 ], 64 [ 65 "Second table-row-group is 100px wide", 66 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetWidth, 67 100 68 ], 69 [ 70 "Second table-row-group is 100px tall", 71 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetHeight, 72 100 73 ], 74 [ 75 "Second table-row-group should be located at 10px left", 76 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetLeft, 77 10 78 ], 79 [ 80 "Second table-row-group should be located at 10px top", 81 document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody + x-tbody").offsetTop, 82 10 83 ], 84 ]) 85 86 </script>