tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

visibility-collapse-rowspan-003.html (3095B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <script src='/resources/testharness.js'></script>
      4 <script src='/resources/testharnessreport.js'></script>
      5 <link rel='stylesheet' href='support/base.css' />
      6 <link rel="author" title="Joy Yu" href="mailto:joysyu@mit.edu">
      7 <link rel="help" href="https://drafts.csswg.org/css-tables-3/#computing-the-table-height">
      8 <style>
      9 table {
     10    border-spacing: 0;
     11    border-collapse: collapse;
     12 }
     13 table td {
     14    border: 1px solid blue;
     15    padding: 5px;
     16 }
     17 </style>
     18 <main>
     19    <h1>Visibility collapse</h1>
     20    <a href="https://drafts.csswg.org/css-tables-3/#computing-the-table-height">Spec</a>
     21    <p>
     22    Setting a row to visibility:collapse changes table height but not width.
     23    Here the spanning cell and another cell are in the same row.
     24    </p>
     25    <table id="one">
     26        <tr id="firstRowRef">
     27            <td>aaaa</td>
     28        </tr>
     29        <tr id="secondRowRef">
     30            <td>bbbb</td>
     31        </tr>
     32        <tr id="collapsedRowRef">
     33            <td rowspan="2">spanning</td>
     34            <td>cccc</td>
     35        </tr>
     36        <tr id="fourthRowRef">
     37            <td>dddd</td>
     38        </tr>
     39        <tr id="fifthRowRef">
     40            <td>eeee</td>
     41        </tr>
     42    </table>
     43    Bottom table is identical to top except third row has been collapsed.
     44    <table id="two">
     45        <tr id="firstRow">
     46            <td>aaaa</td>
     47        </tr>
     48        <tr id="secondRow">
     49            <td>bbbb</td>
     50        </tr>
     51        <tr style="visibility:collapse;" id="collapsedRow">
     52            <td rowspan="2">spanning</td>
     53            <td>cccc</td>
     54        </tr>
     55        <tr id="fourthRow">
     56            <td>dddd</td>
     57        </tr>
     58        <tr id="fifthRow">
     59            <td>eeee</td>
     60        </tr>
     61    </table>
     62 </main>
     63 
     64 <script>
     65    tests = [
     66        [
     67            document.getElementById('two').offsetWidth,
     68            document.getElementById('one').offsetWidth,
     69            "spanning row visibility:collapse doesn't change table width"
     70        ],
     71        [
     72            document.getElementById('collapsedRow').offsetHeight,
     73            0,
     74            "collapsed row has zero height"
     75        ],
     76        [
     77            document.getElementById('firstRow').offsetHeight,
     78            document.getElementById('firstRowRef').offsetHeight,
     79            "first row height doesn't change"
     80        ],
     81        [
     82            document.getElementById('secondRow').offsetHeight,
     83            document.getElementById('secondRowRef').offsetHeight,
     84            "second row height doesn't change"
     85        ],
     86        [
     87            document.getElementById('fourthRow').offsetHeight,
     88            document.getElementById('fourthRowRef').offsetHeight,
     89            "fourth row height doesn't change"
     90        ],
     91        [
     92            document.getElementById('fifthRow').offsetHeight,
     93            document.getElementById('fifthRowRef').offsetHeight,
     94            "fifth row height doesn't change"
     95        ]];
     96    for (i = 0; i< tests.length; i++) {
     97        test(function()
     98            {
     99                assert_equals.apply(this, tests[i]);
    100            },
    101            tests[i][2]);
    102    };
    103 </script>
    104 </html>