summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/file_focus.html
blob: 0bd3f7aa449640bcbe03df1dde4a93e27c92b12d (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
<html>
<body>

Aloha!  My URL is <span id='url'></span>.
<script>
document.getElementById('url').innerHTML = window.location;
</script>

<script>
  // The input element is getting synthesized key events and will prevent
  // default on the first ESC keydown event.

  var alreadyBlocked = false;

  addEventListener('keydown', function(e) {
    if (e.keyCode == SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE &&
        alreadyBlocked == false) {
      alreadyBlocked = true;
      e.preventDefault();
    }
  });
</script>
</body>
</html>