Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: timelapse
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 26 lines (22 sloc) 0.991 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<!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>
Something went wrong with that request. Please try again.