tor-browser

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

scrollintoview-zero-height-item.html (1368B)


      1 <!DOCTYPE html>
      2 <title>CSSOM View - scrollIntoView does not scroll to zero height item</title>
      3 <meta charset="UTF-8">
      4 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <body>
      8 <div style="border: 1px solid black; height: 300px; width: 200px; overflow-y: auto;visibility: hidden" id="box">
      9    <div>text</div>
     10    <div>text</div>
     11    <div>text</div>
     12    <div>text</div>
     13    <div id="text">--- Clicking here should NOT scroll to top ---</div>
     14    <div>text</div>
     15    <div>text</div>
     16    <div>text</div>
     17    <div>text</div>
     18    <div>text</div>
     19    <div>text</div>
     20    <div>text</div>
     21    <div>text</div>
     22    <div>text</div>
     23    <div>text</div>
     24    <div>text</div>
     25    <div>text</div>
     26    <div>text</div>
     27    <div>text</div>
     28    <div>text</div>
     29    <div>text</div>
     30    <div>text</div>
     31    <div>text</div>
     32    <div>text</div>
     33    <div>text</div>
     34 </div>
     35 <script>
     36 test(() => {
     37 box.scrollTop = 40;
     38 
     39 let div = document.createElement("div");
     40 div.textContent = "div";
     41 text.parentNode.insertBefore(div, text);
     42 
     43 let span = document.createElement("span");
     44 span.tabIndex = 0;
     45 div.append(span);
     46 
     47 span.scrollIntoViewIfNeeded();
     48 
     49 assert_equals(box.scrollTop, 40, 'box.scrollTop');
     50 }, `scrollIntoView on zero height item`);
     51 
     52 </script>
     53 </body>