tor-browser

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

compositionstart.keydown.html (2563B)


      1 <!DOCTYPE HTML>
      2 <html>
      3    <head>
      4        <title id='desc'> compositionstart Event and keydown Event </title>
      5        <script type="text/javascript">
      6            var PassTest = function()
      7            {
      8                document.getElementById("testresult").firstChild.data = "PASS";
      9            }
     10 
     11            var FailTest = function()
     12            {
     13                document.getElementById("testresult").firstChild.data = "FAIL";
     14            }
     15 
     16            var TARGET;
     17            var ExpectResult = ["keydown", "compositionstart", "keyup"];
     18            var ActualResult = [];
     19 
     20            window.onload = function(e)
     21            {
     22                try
     23                {
     24                    TARGET = document.getElementById("target");
     25                    TARGET.addEventListener("compositionstart", TestEvent, true);
     26                    TARGET.addEventListener("keydown", TestEvent, true);
     27                    TARGET.addEventListener("keyup", TestEvent, true);
     28                }
     29                catch(ex)
     30                {
     31                    FailTest();
     32                }
     33            }
     34 
     35            function TestEvent(evt)
     36            {
     37                ActualResult.push(evt.type);
     38 
     39                if (evt.type == "keyup")
     40                {
     41                    if (ExpectResult.toString() == ActualResult.toString())
     42                    {
     43                        PassTest();
     44                    }
     45                    else
     46                    {
     47                        FailTest();
     48                    }
     49                    TARGET.removeEventListener("compositionstart", TestEvent, true);
     50                    TARGET.removeEventListener("keydown", TestEvent, true);
     51                    TARGET.removeEventListener("keyup", TestEvent, true);
     52                }
     53            }
     54        </script>
     55    </head>
     56    <body>
     57        <h3>DOM Events</h3>
     58        <h4>
     59            Test Description: When a keyboard is used to feed an input method editor,
     60            compositionstart event type is generated after a keydown event.
     61        </h4>
     62 
     63        <pre>
     64            <input id="target" value=""/>
     65 
     66            Steps:
     67            1) Open Japanese Microsoft IME and select Hiragana input method
     68            2) Type 'a' in the above textbox using keyboard
     69            3) <a href="compositionstart.keydown.html">Click here</a> to test again if not following the steps exactly
     70        </pre>
     71 
     72        <p>Test passes if the word "PASS" appears below after following the above steps.</p>
     73           <div>Test result: </div>
     74        <div id='testresult'>FAIL</div>
     75    </body>
     76 </html>