tor-browser

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

tabindex-getter.html (2642B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: tabIndex getter return value</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <style>
      8 #scrollable {
      9  width: 100px;
     10  height: 100px;
     11  overflow: scroll;
     12 }
     13 #scrollable-inner {
     14  width: 1024px;
     15  height: 2048px;
     16 }
     17 </style>
     18 <body>
     19 <input>
     20 <input type="hidden">
     21 <button>button</button>
     22 <button disabled>button</button>
     23 <button hidden>button</button>
     24 <a>a</a>
     25 <a href="#">a</a>
     26 <svg><a>svg a</a></svg>
     27 <svg><a>svg a</a></svg>
     28 <link id="nohref">
     29 <textarea></textarea>
     30 <select><optgroup><option>option</option></optgroup></select>
     31 <select multiple></select>
     32 <iframe width="10" height="10"></iframe>
     33 <embed width="10" height="10"></embed>
     34 <object width="10" height="10"></object>
     35 <span></span>
     36 <div></div>
     37 <details><summary>summary</summary><summary id="secondsummary">second summary</summary>details</details>
     38 <div id="hostDelegatesFocus"></div>
     39 <div id="hostNonDelegatesFocus"></div>
     40 <div contenteditable="true"></div>
     41 <div id="scrollable"><div id="scrollable-inner"></div></div>
     42 <fieldset></fieldset>
     43 <output></output>
     44 <slot></slot>
     45 <script>
     46 document.getElementById("hostDelegatesFocus").attachShadow({ mode: "open", delegatesFocus: true });
     47 document.getElementById("hostNonDelegatesFocus").attachShadow({ mode: "open", delegatesFocus: false });
     48 const defaultList = [
     49  ["input", 0],
     50  ["input[type='hidden']", 0],
     51  ["button", 0],
     52  ["button[disabled]", 0],
     53  ["button[hidden]", 0],
     54  ["a", 0],
     55  ["a[href]", 0],
     56  ["svg a", 0],
     57  ["textarea", 0],
     58  ["select", 0],
     59  ["select[multiple]", 0],
     60  ["option", -1],
     61  ["optgroup", -1],
     62  ["iframe", 0],
     63  ["embed", -1],
     64  ["object", 0],
     65  ["span", -1],
     66  ["div", -1],
     67  ["link#nohref", -1],
     68  ["link[href]", -1],
     69  ["details", -1],
     70  ["summary", 0],
     71  ["summary#secondsummary", -1],
     72  ["#hostDelegatesFocus", -1],
     73  ["#hostNonDelegatesFocus", -1],
     74  ["div[contenteditable]", -1],
     75  ["#scrollable", -1],
     76  ["fieldset", -1],
     77  ["output", -1],
     78  ["slot", -1],
     79 ];
     80 const tabIndexValue = [-1, 0, 1];
     81 for (const entry of defaultList) {
     82  const element = document.querySelector(entry[0]);
     83  test(() => {
     84    assert_equals(element.tabIndex, entry[1]);
     85  }, entry[0] + ".tabIndex should return " + entry[1] + " by default");
     86  for (const setValue of tabIndexValue ) {
     87    test(() => {
     88      element.setAttribute("tabindex", setValue);
     89      assert_equals(element.tabIndex, setValue);
     90    }, entry[0] + ".tabIndex should return " + setValue + " when set to " + setValue);
     91  }
     92 }
     93 </script>
     94 </body>