tor-browser

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

href-click-003.tentative.html (1405B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>href click</title>
      6 <link rel="help" href="https://w3c.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
      7 <link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/resources/testdriver.js"></script>
     11 <script src="/resources/testdriver-vendor.js"></script>
     12 </head>
     13 <body>
     14  <p>To test manually, click the blue rectangle.</p>
     15  <p>
     16    <math>
     17      <mspace width="50px" height="10px" style="background: gray"></mspace>
     18      <mspace id="target" href="javascript:handler()" width="50px" height="10px" style="background: blue"></mspace>
     19      <mspace width="50px" height="10px" style="background: gray"></mspace>
     20    </math>
     21  </p>
     22  <a id="badTarget" href="javascript:badHandler()">DON'T CLICK ME</a>
     23  <script>
     24    var t = async_test("Click element with href");
     25    function handler() { t.done(); }
     26    function badHandler() {
     27      t.step(() => { assert_unreached("Bad handler executed"); });
     28      t.done();
     29    }
     30    test_driver.click(document.getElementById("target")).then(() => {
     31      return test_driver.click(document.getElementById("badTarget"));
     32    }).catch(() => {
     33      t.step(() => { assert_unreached("Click failed"); });
     34      t.done();
     35    });
     36  </script>
     37 </body>
     38 </html>