summaryrefslogtreecommitdiffstats
path: root/dom/base/test/fullscreen/file_fullscreen-api-keys.html
blob: f526aa55ba9fc829f144367e9c60747679a7b3c2 (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
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
</head>
<body>
<script>
window.addEventListener("Test:DispatchKeyEvents", aEvent => {
  var keyCode = KeyEvent["DOM_" + aEvent.detail.code];

  document.body.focus();
  var evt = new KeyboardEvent("keydown", {
    bubbles: true,
    cancelable: true,
    view: window,
    keyCode,
    charCode: 0,
  });
  document.body.dispatchEvent(evt);

  evt = new KeyboardEvent("keypress", {
    bubbles: true,
    cancelable: true,
    view: window,
    keyCode,
    charCode: 0,
  });
  document.body.dispatchEvent(evt);

  evt = new KeyboardEvent("keyup", {
    bubbles: true,
    cancelable: true,
    view: window,
    keyCode,
    charCode: 0,
  });
  document.body.dispatchEvent(evt);
});
</script>
</body>
</html>