var currentTest = 0; var tests = [ testLinkInLinkMouse, testLinkInLinkKeyboard,
testInputInLinkMouse, testInputInLinkKeyboard,
testButtonInLinkMouse, testButtonInLinkKeyboard ];
function doNextTest() {
if (currentTest == tests.length) {
SimpleTest.finish();
} else {
tests[currentTest++]();
}
}
function generateLinkInLink(id, desc) { var doc = $(id).contentDocument; var outerA = doc.createElement("a"); var innerA = doc.createElement("a");
outerA.id = "outer";
innerA.id = "inner";
innerA.href = PASSURL;
outerA.href = FAILURL;
innerA.appendChild(doc.createTextNode("Text"));
outerA.appendChild(innerA);
doc.body.appendChild(outerA);
$(id).onload = function() {
is(this.contentDocument.documentElement.innerText, "PASS", desc);
// Have to remove the iframe we used from the DOM, because the harness is
// stupid and doesn't have enough space for more than one iframe.
$(id).remove();
doNextTest();
};
return [innerA, $(id).contentWindow];
}
function testLinkInLinkMouse() { var [innerA, testWin] =
generateLinkInLink("link-in-link-mouse", "Clicking an inner link should load the inner link");
synthesizeMouseAtCenter(innerA, {}, testWin);
}
function testLinkInLinkKeyboard() { var [innerA, testWin] =
generateLinkInLink("link-in-link-keyboard", "Hitting enter on an inner link should load the inner link");
innerA.focus();
synthesizeKey("VK_RETURN", {}, testWin);
}
function generateInputInLink(id, desc) { var doc = $(id).contentDocument;
doc.body.innerHTML = ";
$(id).onload = function() {
is(this.contentDocument.documentElement.innerText, "PASS", desc);
// Have to remove the iframe we used from the DOM, because the harness is
// stupid and doesn't have enough space for more than one iframe.
$(id).remove();
doNextTest();
}; varinput = doc.getElementById("submit");
doc.body.offsetWidth;
return [input, $(id).contentWindow];
}
function testInputInLinkMouse() { var [input, testWin] =
generateInputInLink("input-in-link-mouse", "Clicking an submit input inside an anchor should submit the form");
synthesizeMouseAtCenter(input, {}, testWin);
}
function testInputInLinkKeyboard() { var [input, testWin] =
generateInputInLink("input-in-link-keyboard", "Return on submit input inside an anchor should submit the form"); input.focus();
synthesizeKey("VK_RETURN", {}, testWin);
}
function generateButtonInLink(id, desc) { var doc = $(id).contentDocument;
doc.body.innerHTML = ";
$(id).onload = function() {
is(this.contentDocument.documentElement.innerText, "PASS", desc);
// Have to remove the iframe we used from the DOM, because the harness is
// stupid and doesn't have enough space for more than one iframe.
$(id).remove();
doNextTest();
}; varbutton = doc.getElementById("submit");
return [button, $(id).contentWindow];
}
function testButtonInLinkMouse() { var [button, testWin] =
generateButtonInLink("button-in-link-mouse", "Clicking an submit button inside an anchor should submit the form");
synthesizeMouseAtCenter(button, {}, testWin);
}
function testButtonInLinkKeyboard() { var [button, testWin] =
generateButtonInLink("button-in-link-keyboard", "Return on submit button inside an anchor should submit the form"); button.focus();
synthesizeKey("VK_RETURN", {}, testWin);
}
// We need focus to handle clicks properly
SimpleTest.waitForFocus(doNextTest);
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
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.