<!DOCTYPE html>
<html>
<body>
<p>This test ensures WebKit does not clear undo stack in a contenteditable element when setting the value of input or textarea element.</p>
<input type="text">
<textarea></textarea>
<div contenteditable>PASS</div>
<script>

document.getElementsByTagName('div')[0].focus();
document.execCommand('SelectAll', false, null);
document.execCommand('InsertText', false, 'FAIL');
document.getElementsByTagName('input')[0].value = 'hello';
document.getElementsByTagName('textarea')[0].value = 'world';
document.execCommand('Undo', false, null);

if (window.testRunner)
    testRunner.dumpAsText();

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