<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>

<input type="text" id="sp" style="-khtml-appearance:textfield" maxlength=5 value="123456"></input>

<script>
description('This test changes the value of the text field by simulating typing, and then gets the value.');

var input = document.getElementById('sp');

if (input.value != "12345") {
    testPassed('Maxlength shouldn\'t work for default value.');
} else {
    testFailed('Maxlength unexpectedly works for default value.');
}
    
input.value = "123";
input.setSelectionRange(0, 3);
input.focus();
document.execCommand("InsertText", false, 'abcd');
document.execCommand("InsertText", false, 'efghi');
    
if (input.value == "abcde") {
    testPassed('Maxlength works for inserted text.');
} else {
    testFailed('Maxlength does not work for inserted text.');
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
