52 lines
2.1 KiB
HTML
52 lines
2.1 KiB
HTML
<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>
|