Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 1b41cc5725
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (22 sloc) 0.991 kB
<!DOCTYPE html>
<html>
<body>
<p>This tests selectionStart is updated properly when inserting LF into textarea. To test, press Enter several times inside textarea and click the log button. This bug does not reproduce when new lines are added by execCommand or eventSender.</p>
<textarea cols="20" rows="20"></textarea>
<button id="button" onclick="verify()">verify</button>
<div id="console"></div>
<script>
function verify() {
var console = document.getElementById('console');
if (textarea.value.match(/[^\n]/))
console.innerHTML = 'textarea contains unexpected character. You can only type LF in this test.';
else if (textarea.selectionStart != textarea.value.length)
console.innerHTML = 'FAIL: expected ' + textarea.value.length + ' but got ' + textarea.selectionStart;
else
console.innerHTML = 'PASS: ' + textarea.value.length + ' LFs';
}
var textarea = document.getElementsByTagName('textarea')[0];
textarea.focus();
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.