tor-browser

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

option-index.html (1468B)


      1 <!DOCTYPE HTML>
      2 <title>HTMLOptionElement.prototype.index</title>
      3 <link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-option-index">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 
      8 <select>
      9 <option id="option0">hello</option>
     10 <option id="option1">hello</option>
     11 </select>
     12 
     13 
     14 <datalist>
     15 <option id="dl-option0">hello</option>
     16 <option id="dl-option1">hello</option>
     17 </datalist>
     18 
     19 <option id="doc-option0">hello</option>
     20 <option id="doc-option1">hello</option>
     21 
     22 <script>
     23 "use strict";
     24 
     25 test(() => {
     26 
     27  assert_equals(document.querySelector("#option0").index, 0);
     28  assert_equals(document.querySelector("#option1").index, 1);
     29 
     30 }, "option index should work inside the document");
     31 
     32 test(() => {
     33 
     34  assert_equals(document.querySelector("#dl-option0").index, 0);
     35  assert_equals(document.querySelector("#dl-option1").index, 0);
     36 
     37 }, "option index should always be 0 for options in datalists");
     38 
     39 test(() => {
     40 
     41  assert_equals(document.querySelector("#doc-option0").index, 0);
     42  assert_equals(document.querySelector("#doc-option1").index, 0);
     43 
     44 }, "option index should always be 0 for options with no container");
     45 
     46 test(() => {
     47 
     48  assert_equals(document.createElement("option").index, 0);
     49  assert_equals(document.createElement("option").index, 0);
     50 
     51 }, "option index should always be 0 for options not even in the document");
     52 
     53 
     54 </script>