| <p>This tests pasting two lines of text copied from pre content. |
| To manually test, copy the selected text (including the new line) and paste it into textarea twice. |
| There should be no blank line between two pasted lines.</p> |
| <pre oncopy="setTimeout(function () { textarea.focus(); }, 0);">A line of text |
| <textarea cols="10" rows="5" oninput="document.getElementById('console').textContent = textarea.value;"></textarea> |
| var textarea = document.querySelector('textarea'); |
| getSelection().collapse(document.querySelector('pre'), 0); |
| getSelection().modify('extend', 'forward', 'line'); |
| if (document.queryCommandSupported('paste')) { |
| document.execCommand('copy', false, null); |
| document.execCommand('paste', false, null); |
| document.execCommand('paste', false, null); |