tor-browser

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

offsetTopLeft-table-caption.html (1090B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent">
      4 <title>offset* APIs on tables with captions.</title>
      5 <script src=/resources/testharness.js></script>
      6 <script src=/resources/testharnessreport.js></script>
      7 <table style="border-spacing: 0px">
      8 <caption>I'm a <br>reasonably<br>tall caption.</caption>
      9 <tr><td><span>I'm a cell.</span>
     10 </table>
     11 <script>
     12  let td = document.querySelector("td");
     13  let span = document.querySelector("span");
     14  let caption = document.querySelector("caption");
     15  let table = document.querySelector("table");
     16  test(function() {
     17    assert_equals(span.offsetParent, td, "<td> should be an offset parent");
     18    assert_equals(td.offsetParent, table, "<table> should be an offset parent for <td>");
     19    assert_equals(caption.offsetParent, table, "<table> should be an offset parent for <caption>");
     20    assert_equals(caption.offsetTop, 0, "<caption> is at the top of its offsetParent");
     21    assert_equals(td.offsetTop, caption.offsetHeight, "<td> is under the caption");
     22  });
     23 </script>