tor-browser

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

disabledElement.html (1685B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <title>Disabled elements</title>
      4 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
      5 <link rel=help href="https://html.spec.whatwg.org/multipage/#disabled-elements">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <div id="log"></div>
      9 <button disabled>button</button>
     10 <input disabled>
     11 <select disabled>
     12 <optgroup label="options" disabled>
     13  <option value="option1" disabled>option1
     14  <option value="option2">option2
     15 </select>
     16 <textarea disabled>textarea</textarea>
     17 <fieldset disabled>
     18 <input type=radio name=c value=0 checked>
     19 <input type=radio name=c value=1>
     20 </fieldset>
     21 <a href="http://www.w3.org/" disabled>w3</a>
     22 <span tabindex=0 disabled>foobar</span>
     23 
     24 <script>
     25  test(function(){
     26    assert_equals(document.activeElement, document.body);
     27  }, "The body element must be the active element if no element is focused");
     28 
     29  ["button", "input", "select", "optgroup", "option", "textarea", "input[type=radio]"].forEach(function(el) {
     30    test(function() {
     31      var element = document.querySelector(el);
     32      element.focus();
     33      assert_equals(document.activeElement, document.body, "activeElement after focus on a disabled <" + el + "> remains unchanged");
     34    }, "A disabled <" + el + "> should not be focusable");
     35  });
     36 
     37  ["a", "span"].forEach(function(el) {
     38    test(function() {
     39      var element = document.querySelector(el);
     40      element.focus();
     41      assert_equals(document.activeElement, element, "focus on a <" + el + "> with a disabled attribute should make it the activeElement");
     42    }, "A disabled <" + el + "> should be focusable");
     43  });
     44 </script>