summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/select/select-change-popup-to-listbox-in-event-handler.html
blob: a2722b3ebbd5edda93125e9b8664a394b9d2b8c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE>
<html>
<head>
  <title>Change popup to list inside mouse event handler.</title>
  <script type="text/javascript" charset="utf-8">
    if (window.testRunner)
      testRunner.dumpAsText();

    function sendClick()
    {
      var select = document.getElementById("select");
      var rect = select.getBoundingClientRect();

      var evt = document.createEvent("MouseEvents");
      evt.initMouseEvent("mousedown", true, true, window,
        0, 0, 0, rect.top + 4, rect.left + 4, false, false, false, false, 0, null);

      select.dispatchEvent(evt);
    }
    
    window.addEventListener('load', sendClick, false);
  </script>
</head>
<body>
  <p>This test should not crash.</p>
  <select id="select" onFocus="this.size = 10">
    <option value="0">One</option>
    <option value="1">Two</option>
    <option value="2">Three</option>
  </select>
</body>
</html>