var gKeyPress = null;
function onKeyPress(aEvent)
{
gKeyPress = aEvent;
is(aEvent.target, document.getElementById("input-text"), "input element should have focus");
ok(!aEvent.defaultPrevented, "keypress event should be consumed before keypress event handler");
}
function runTests()
{
document.addEventListener("keypress", onKeyPress); varinput = document.getElementById("input-text"); input.focus();
input.addEventListener("input", function (aEvent) {
ok(gKeyPress, "Test1: keypress event must be fired before an input event");
ok(gKeyPress.defaultPrevented, "Test1: keypress event's defaultPrevented should be true in chrome even if it's consumed by default action handler of editor");
setTimeout(function () {
ok(gKeyPress.defaultPrevented, "Test2: keypress event's defaultPrevented should be true after event dispatching finished");
SimpleTest.finish();
}, 0);
}, {once: true});
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.