blob: 84fb4674ae3b0e4e1419ae1d4dee04570b2e3205 [file] [log] [blame]
<p>This test verifies that the ENTER key fires the change event.</p>
<hr>
<input id="input" type="search" onchange="changeHandler()" onblur="blurHandler()"></input>
<pre id="console"></pre>
<script>
function log(s)
{
document.getElementById('console').appendChild(document.createTextNode(s + "\n"));
}
function changeHandler()
{
log ('PASS: change event fired.\n');
}
function blurHandler()
{
log ('blur event fired.\n');
}
if (window.layoutTestController)
layoutTestController.dumpAsText();
// change the field
document.getElementById('input').focus();
document.execCommand("InsertText", false, "foo bar baz");
// hit enter
var enterEvent = document.createEvent("KeyboardEvents");
enterEvent.initKeyboardEvent("keypress", true, false, window, "Enter", 0, false, false, false, false, false); // This is not at all like pulling teeth
input.dispatchEvent(enterEvent);
</script>