<!DOCTYPE html>
<html>
<head>
<style type="text/css">
br {visibility:hidden}
</style>
</head>
<body>
<p>This test ensures WebKit does not lose focus when the text is removed from a text field when br's visibility is hidden.</p>
<form>
<fieldset>
<input id="test" type="text">
</fieldset>
</form>
<script>

var test = document.getElementById('test');
test.focus();
document.execCommand('InsertText', false, 'abc');
document.execCommand('Delete', false, null);
document.execCommand('Delete', false, null);
document.execCommand('Delete', false, null);
document.execCommand('InsertText', false, 'PASS');

if (test.value != 'PASS')
    test.value = 'FAIL';

if (window.testRunner) {
    testRunner.dumpAsText();
    test.parentNode.parentNode.style.display = 'none';
    document.writeln(test.value);
}

</script>
</body>
</html>
