mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
Implement the accessKeyLabel IDL attribute per the HTML spec. We mimic Chromium's behavior and treat the accesskey attribute value as a single key rather than splitting on whitespace, since no browser besides IE/Edge implemented the spec's splitting approach. See https://github.com/whatwg/html/issues/3769
28 lines
851 B
HTML
28 lines
851 B
HTML
<!DOCTYPE html>
|
|
<meta charset="UTF-8">
|
|
<title>accessKeyLabel attribute</title>
|
|
<script src="../../resources/testharness.js"></script>
|
|
<script src="../../resources/testharnessreport.js"></script>
|
|
<body>
|
|
<script>
|
|
function createButtonWithAccessKey(accessKey) {
|
|
const button = document.createElement('button');
|
|
button.setAttribute('accesskey', accessKey);
|
|
return button;
|
|
}
|
|
|
|
// The modifiers are not the same across all browser vendors.
|
|
// Therefore, the test uses non empty.
|
|
test(() => {
|
|
const element = createButtonWithAccessKey('b');
|
|
assert_not_equals(element.accessKeyLabel, '');
|
|
}, 'Returns non empty string when accesskey is valid');
|
|
|
|
test(() => {
|
|
const element = createButtonWithAccessKey('s 0');
|
|
assert_equals(element.accessKeyLabel, '');
|
|
}, 'Returns empty string when accesskey is invalid');
|
|
</script>
|
|
</body>
|
|
</html>
|