tor-browser

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

focus-02.html (1510B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: focus - key events</title>
      4 <meta name="timeout" content="long">
      5 <link rel="author" title="Intel" href="http://www.intel.com/">
      6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#focus">
      7 <meta assert="flag" content="interact">
      8 <meta assert="assert" content="Check if the key events received by document are targeted at the element when no element is focused">
      9 <script src="/resources/testharness.js"></script>
     10 <script src="/resources/testharnessreport.js"></script>
     11 <script src="/resources/testdriver.js"></script>
     12 <script src="/resources/testdriver-vendor.js"></script>
     13 <div id="log"></div>
     14 <script>
     15 
     16 var t1 = async_test("The keydown event must be targeted at the body element"),
     17    t2 = async_test("The keypress event must be targeted at the body element"),
     18    t3 = async_test("The keyup event must be targeted at the body element");
     19 
     20 setup({timeout: 10000});
     21 
     22 document.onkeydown = t1.step_func_done(function(evt){
     23  assert_equals(evt.target, document.body, "The keydown events must be targeted at the document's body.");
     24 });
     25 
     26 document.onkeypress = t2.step_func_done(function(evt){
     27  assert_equals(evt.target, document.body, "The keypress events must be targeted at the document's body.");
     28 });
     29 
     30 document.onkeyup = t3.step_func_done(function(evt){
     31  assert_equals(evt.target, document.body, "The keyup events must be targeted at the document's body.");
     32 });
     33 
     34 t1.step(function() {
     35  test_driver.send_keys(document.body, "a");
     36 });
     37 
     38 </script>