blob: cd7c8227aac8b85a2ca71afe99dc4d0a0ea6f24d (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<html>
<head>
<script type="text/javascript">
function print(message)
{
var paragraph = document.createElement("li");
paragraph.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(paragraph);
}
function test()
{
if (window.testRunner) {
testRunner.dumpAsText();
}
var elt = document.getElementById("text");
txt = "this is\ra test\rof cursor";
txt2 = "this is\na test\nof cursor!";
// test getCursorPosition...
elt.value = txt;
elt.setSelectionRange(10, 14);
elt.focus();
elt.value = txt2;
elt.focus();
print(elt.selectionStart.toString() + ", " + elt.selectionEnd.toString());
// test setCursorPosition...
elt.value = txt2;
elt.setSelectionRange(10, 14);
elt.focus();
elt.value = txt;
elt.focus();
print(elt.selectionStart.toString() + ", " + elt.selectionEnd.toString());
}
</script>
</head>
<body onload="test();">
<p>This test used to check that the selection start was the same before and after a change to the contents of a textarea.</p>
<p>However now, in order to match the behavior of the other major browsers, selection is moved to the end of the text value when a change occurs to the contents of a text area.</p>
<p>Because this would invalidate the previous test, and that the previous test now perfectly shows the new behavior, we repurposed it.</p>
<br />
<p>rdar://problem/5423067 gmail is super annoying when trying to add a new name to the TO, CC or BCC fields</p>
<hr />
<form>
<textarea id="text"></textarea>
</form>
<hr />
<p><ol id="console"></ol></p>
</body>
</html>
|