function test(edit) {
edit.focus(); var sel = window.getSelection();
sel.collapse(edit.childNodes[0], edit.textContent.length - 1);
synthesizeKey("KEY_Backspace");
is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly");
}
function testWithMove(edit, offset) {
edit.focus(); var sel = window.getSelection();
sel.collapse(edit.childNodes[0], 0); var i;
for (i = 0; i < offset; ++i) {
synthesizeKey("KEY_ArrowRight");
synthesizeKey("KEY_ArrowLeft");
synthesizeKey("KEY_ArrowRight");
}
synthesizeKey("KEY_Backspace");
is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly");
}
function runTest() {
/* test backspace-deletion of the middle character */
test(document.getElementById("edit0"));
test(document.getElementById("edit1"));
test(document.getElementById("edit2"));
test(document.getElementById("edit3"));
/* extra tests with the use of RIGHT and LEFT to get to the right place */
testWithMove(document.getElementById("edit0b"), 2);
testWithMove(document.getElementById("edit1b"), 1);
testWithMove(document.getElementById("edit2b"), 2);
testWithMove(document.getElementById("edit3b"), 1);
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.5Angebot
¤
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 ist noch experimentell.