function reset() { div.innerHTML = "x y"; div.focus();
synthesizeKey("KEY_ArrowDown");
}
function checks(msg) {
is(div.innerHTML, "x
",
msg + ": Should add a second to prevent collapse of first");
is(div.childNodes.length, 3, msg + ": No empty text nodes allowed");
ok(getSelection().isCollapsed, msg + ": Selection must be collapsed");
is(getSelection().focusNode, div, msg + ": Focus must be in div");
is(getSelection().focusOffset, 2,
msg + ": Focus must be between the two s");
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
// Put selection after the "y" and backspace
reset();
synthesizeKey("KEY_ArrowRight");
synthesizeKey("KEY_Backspace");
checks("Collapsed backspace");
// Now do the same with delete
reset();
synthesizeKey("KEY_Delete");
checks("Collapsed delete");
// Make sure we're not deleting if the whitespace isn't actually collapsed div.style.whiteSpace = "pre-wrap";
reset();
synthesizeKey("KEY_ArrowRight");
synthesizeKey("KEY_ArrowRight");
synthesizeKey("KEY_Backspace");
is(div.innerHTML, "x ", "pre-wrap: Don't delete uncollapsed space");
ok(getSelection().isCollapsed, "pre-wrap: Selection must be collapsed");
is(getSelection().focusNode, div.lastChild, "pre-wrap: Focus must be in final text node");
is(getSelection().focusOffset, 1, "pre-wrap: Focus must be at end of node");
SimpleTest.finish();
});
</script>
¤ 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.0.12Bemerkung:
(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 ist noch experimentell.