<!DOCTYPE html>
<html>
<body>
<p>This tests pasting into a textarea that starts with a line break that didn't initially have a renderer (display: none).
WebKit should still be able to paste text with line breaks.</p>
<textarea id="test" style="display: none" cols="50" rows="10"></textarea>
<div id="log"></div>
<script type="text/javascript">

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

var textarea = document.querySelector('textarea');
textarea.value = "\nwebkit";
textarea.style.display = "";

textarea.focus();
textarea.selectionStart = textarea.selectionEnd = 0;
document.execCommand('insertHTML', false, 'hello\nworld\n');

var expected = 'hello\nworld\nwebkit';
if (textarea.value == expected)
    document.getElementById('log').innerText = 'PASS';
else
    document.getElementById('log').innerText = 'FAILED: expected "' + expected + '" but got "' + textarea.value + '"';

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