tor-browser

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

focus-autofocus.html (1005B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <title>Selector: pseudo-classes (:focus for autofocus)</title>
      4 <link rel="author" title="Kent Tamura" href="mailto:tkent@chromium.org">
      5 <link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes">
      6 <link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#autofocusing-a-form-control:-the-autofocus-attribute">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <body>
     10 <script>
     11 // This test can't be merged to focus.html because element.focus() may affect
     12 // autofocus behavior.
     13 var autofocusTest = async_test(":focus selector should work with an autofocused element.");
     14 var input = document.createElement("input");
     15 input.autofocus = true;
     16 input.addEventListener("focus", function() {
     17  autofocusTest.step(function() {
     18    assert_array_equals(document.querySelectorAll(":focus"), [input])
     19    autofocusTest.done();
     20  });
     21 }, false);
     22 document.body.appendChild(input);
     23 </script>
     24 </body>