function handleFocus(e) {
ok("accessKey" in e, "(focus) accesskey property not found on element"); var expected = focusArray.shift();
// "k" and "n" are a special cases because the element receiving the focus
// is not the element which has the accesskey.
if (expected == "k" || expected == "n") {
ok(e.value == "test for label", "(focus) unexpected element: " + e.value + " expected: " + "test for label");
// "l" is a special case because the element receiving the focus is not
// the element which has the accesskey.
} else if (expected == "l") {
ok(e.value == "test for legend", "(focus) unexpected element: " + e.value + " expected: " + "test for legend");
} else {
ok(expected == e.accessKey, "(focus) unexpected element: " + e.accessKey + " expected: " + expected);
}
}
function handleClick(e) {
ok("accessKey" in e, "(click) accesskey property not found on element");
}
function handleInvalid(e) {
ok("accessKey" in e, "(invalid) accesskey property not found on element");
ok(false, "(invalid) accesskey should not have any effect on this element: " +
e.localName);
}
function pressAccessKey(key) {
synthesizeKey(key.key, {altKey: true, shiftKey: true});
}
function testFocusableElements() {
for (varcode = "a".charCodeAt(0); code <= "y".charCodeAt(0); ++ code) {
// XXX the "map" test is causing trouble, see bug 433089
if (code == "b".charCodeAt(0))
continue; var accessChar = String.fromCharCode(code).toUpperCase();
pressAccessKey({key: accessChar});
}
ok(!focusArray.length, "(focus) unhandled elements remaining: " + focusArray.join(","));
}
function createUnfocusableElement(elem, accesskey) {
ok("tag" in elem, "invalid object passed to createUnfocusableElement: " + elem.toString()); var e = document.createElement(elem.tag);
if ("content" in elem) {
e.innerHTML = elem.content;
}
if ("attribs" in elem) {
for (var attr in elem.attribs) {
e.setAttribute(attr, elem.attribs[attr]);
}
}
e.setAttribute("accesskey", accesskey);
e.setAttribute("onclick", "handleClick(event.target); event.preventDefault();");
e.setAttribute("onfocus", "handleInvalid(event.target);"); var parent = null; var elementToInsert = null;
if ("parent" in elem) {
parent = document.getElementById(elem.parent);
elementToInsert = e;
} else {
parent = document.getElementById("tbody");
elementToInsert = document.createElement("tr"); vartd = document.createElement("td"); td.textContent = elem.tag;
elementToInsert.appendChild(td); td = document.createElement("td"); td.appendChild(e);
elementToInsert.appendChild(td);
}
ok(parent != null, "parent element not specified for element: " + elem.tag);
ok(elementToInsert != null, "elementToInsert not specified for element: " + elem.tag);
elementToInsert.setAttribute("id", unfocusableElementId);
if ("where" in elem) {
if (elem.where == "first") {
parent.insertBefore(elementToInsert, parent.firstChild);
} else {
ok(false, "invalid where value specified for element: " + elem.tag);
}
} else {
parent.appendChild(elementToInsert);
}
}
function destroyUnfocusableElement() { var el = document.getElementById(unfocusableElementId);
ok(el != null, "unfocusable element not found");
el.remove();
ok(document.getElementById(unfocusableElementId) == null, "unfocusable element not properly removed");
}
function testUnfocusableElements() { var i, e;
for (i = 0; i < unfocusableTags.length; ++ i) {
createUnfocusableElement(unfocusableTags[i], "z");
pressAccessKey({key: "Z"});
destroyUnfocusableElement();
}
for (i = 0; i < invalidElements.length; ++ i) {
e = document.getElementById(invalidElements[i]);
ok(e != null, "element with ID " + invalidElements[i] + " not found");
e.setAttribute("accesskey", "z");
e.setAttribute("onclick", "handleClick(event.target); event.preventDefault();");
e.setAttribute("onfocus", "handleInvalid(event.target);");
pressAccessKey({key: "Z"});
e.removeAttribute("accesskey");
e.removeAttribute("onclick");
e.removeAttribute("onfocus");
}
}
function start() {
testFocusableElements();
testUnfocusableElements();
SimpleTest.finish();
}
function doTest() {
SpecialPowers.pushPrefEnv({"set": [["ui.key.contentAccess", 5]]}, start);
}
dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy
dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy
dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
lazy dog. The quick brown fox jumps over the lazy dog.
</div>
</td>
</tr>
<tr>
<td>contenteditable div(focusable)</td>
<td>
<div onclick="handleClick(event.target);" onfocus="handleFocus(event.target)" accesskey="y" contenteditable="true">
Test text.....
</div>
</td>
</tr>
</tbody>
</table>
<dl id="dl"></dl>
<ul id="ul"></ul>
<ol id="ol"></ol>
<select id="select"></select>
</body>
</html>
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.18Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-04-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.