tor-browser

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

test_dblclick_explicit_original_target.html (1772B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test explicit original target of dblclick event</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 <body>
     10 <p id="display">Test explicit original target of dblclick event</p>
     11 <div id="content" style="display: none">
     12 
     13 </div>
     14 <pre id="test">
     15 <script type="application/javascript">
     16 
     17 SimpleTest.waitForExplicitFinish();
     18 SimpleTest.waitForFocus(runTests);
     19 
     20 function runTests()
     21 {
     22  synthesizeMouse(document.getElementById("display"), 5, 5, { clickCount: 2 });
     23 }
     24 
     25 window.onmousedown = function(event) {
     26  is(event.explicitOriginalTarget.nodeType, Node.TEXT_NODE,
     27     "explicitOriginalTarget is a text node");
     28  is(event.explicitOriginalTarget, document.getElementById("display").firstChild,
     29     "explicitOriginalTarget should point to the child node of the click target");
     30 }
     31 
     32 window.onmouseup = function(event) {
     33  is(event.explicitOriginalTarget.nodeType, Node.TEXT_NODE,
     34     "explicitOriginalTarget is a text node");
     35  is(event.explicitOriginalTarget, document.getElementById("display").firstChild,
     36     "explicitOriginalTarget should point to the child node of the click target");
     37 }
     38 
     39 // The old versions of Gecko had explicitOriginalTarget pointing to a Text node
     40 // when handling *click events, newer versions target Elements.
     41 window.ondblclick = function(event) {
     42  is(event.explicitOriginalTarget.nodeType, Node.ELEMENT_NODE,
     43     "explicitOriginalTarget is an element node");
     44    is(event.explicitOriginalTarget, document.getElementById("display"),
     45     "explicitOriginalTarget should point to the click target");
     46  SimpleTest.finish();
     47 }
     48 
     49 </script>
     50 </pre>
     51 </body>
     52 </html>