blob: de65ffa2cb624d0b80a711ade1e586a966509af1 (
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
42
43
44
45
46
47
48
49
50
|
<!DOCTYPE html>
<html>
<head>
<title>Mutating accesskey attribute</title>
<script src="../../resources/js-test.js"></script>
</head>
</head>
<body>
<script>
description('Access key should work after accesskey attribute is mutated. To test this manually, press <alt>+a, <alt>+b and <alt>+c keys in this order (on Mac OS X, press <Ctrl>+<Opt> instead of <alt>).');
window.jsTestIsAsync = true;
function pressKey(key)
{
if (navigator.userAgent.search(/\bMac OS X\b/) !== -1)
modifiers = ["ctrlKey", "altKey"];
else
modifiers = ["altKey"];
if (window.eventSender)
eventSender.keyDown(key, modifiers);
}
document.addEventListener("DOMContentLoaded", function () {
var input = document.createElement('input');
input.accessKey = 'a';
input.onfocus = function () {
testPassed('Pressing the "a" access key triggered a focus event.');
input.blur();
input.accessKey = 'b';
input.onfocus = function () {
testPassed('Pressing the "b" access key triggered a focus event.');
input.blur();
input.setAttribute('accesskey', 'c');
input.onfocus = function () {
testPassed('Pressing the "c" access key triggered a focus event.');
document.body.removeChild(input);
finishJSTest();
};
pressKey('c');
};
pressKey('b');
};
document.body.appendChild(input);
pressKey('a');
});
</script>
</body>
</html>
|