62 lines
1.7 KiB
HTML
62 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Case insensitiveness of accesskey attribute</title>
|
|
<script src="../../resources/js-test.js"></script>
|
|
</head>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
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>).');
|
|
|
|
window.jsTestIsAsync = true;
|
|
|
|
function isUpperCase(string)
|
|
{
|
|
return string === string.toUpperCase();
|
|
}
|
|
|
|
function pressKey(key)
|
|
{
|
|
var modifiers;
|
|
if (navigator.userAgent.search(/\bMac OS X\b/) !== -1)
|
|
modifiers = ["ctrlKey", "altKey"];
|
|
else
|
|
modifiers = ["altKey"];
|
|
|
|
if (isUpperCase(key)) {
|
|
modifiers.push("shiftKey");
|
|
key = key.toLowerCase();
|
|
}
|
|
|
|
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>
|