4 <title>Case insensitiveness of accesskey attribute
</title>
5 <script src=
"../../resources/js-test.js"></script>
10 description('Access key should work case-insensitively. To test this manually, press <alt>+a, <alt>+<shift>+b and <alt>+<shift>+c keys in this order (on Mac OS X, press <ctrl>+<opt> instead of <alt>).');
12 window
.jsTestIsAsync
= true;
14 function isUpperCase(string
)
16 return string
=== string
.toUpperCase();
19 function pressKey(key
)
22 if (navigator
.userAgent
.search(/\bMac OS X\b/) !== -1)
23 modifiers
= ["ctrlKey", "altKey"];
25 modifiers
= ["altKey"];
27 if (isUpperCase(key
)) {
28 modifiers
.push("shiftKey");
29 key
= key
.toLowerCase();
32 if (window
.eventSender
)
33 eventSender
.keyDown(key
, modifiers
);
36 document
.addEventListener("DOMContentLoaded", function () {
37 var input
= document
.createElement('input');
38 input
.accessKey
= 'A';
39 input
.onfocus = function () {
40 testPassed('Pressing the "a" access key triggered a focus event.');
42 input
.accessKey
= 'b';
43 input
.onfocus = function () {
44 testPassed('Pressing the "B" access key triggered a focus event.');
46 input
.setAttribute('accesskey', 'C');
47 input
.onfocus = function () {
48 testPassed('Pressing the "C" access key triggered a focus event.');
49 document
.body
.removeChild(input
);
56 document
.body
.appendChild(input
);