tor-browser

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

select-value.html (1348B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>HTMLSelectElement.value</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-select-value">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id=log></div>
      8 
      9 <select id=sel1>
     10  <option value=0></option>
     11  <option selected value=1></option>
     12 </select>
     13 
     14 <select id=sel2>
     15  <optgroup>
     16    <option value=0></option>
     17  </optgroup>
     18  <optgroup></optgroup>
     19  <optgroup>
     20    <option></option>
     21    <option value=1></option>
     22    <option selected value=2></option>
     23  </optgroup>
     24 </select>
     25 
     26 <select id=sel3>
     27  <option selected value=1></option>
     28 </select>
     29 
     30 <select id=sel4></select>
     31 
     32 <script>
     33 test(function() {
     34  var select = document.getElementById('sel1');
     35  assert_equals(select.value, '1');
     36 }, 'options');
     37 
     38 test(function() {
     39  var select = document.getElementById('sel2');
     40  assert_equals(select.value, '2');
     41 }, 'optgroups');
     42 
     43 test(function() {
     44  var select = document.getElementById('sel3');
     45  var option = select.options[0];
     46  var div = document.createElement('div');
     47  select.appendChild(div);
     48  div.appendChild(option);
     49  assert_equals(select.value, '1');
     50 }, 'option is child of div');
     51 
     52 test(function() {
     53  var select = document.getElementById('sel4');
     54  assert_equals(select.value, '');
     55 }, 'no options');
     56 </script>