5 <script src=
"../../../resources/js-test.js"></script>
6 <script src=
"../resources/common-setrangetext.js"></script>
10 description("Test setRangeText() method on textareas.");
12 runTestsShouldPass("textarea");
14 element
= document
.createElement("textarea");
15 document
.body
.appendChild(element
);
16 debug("\nCheck that setRangeText() on textareas doesn't affect scroll position.");
18 for (var i
= 0; i
< 20; i
++)
19 longString
+= "0123456789\n";
20 evalAndLog("element.value = longString");
21 evalAndLog("element.scrollTop = 0");
22 evalAndLog("element.setSelectionRange(100, 110)");
23 evalAndLog("element.setRangeText('A', 9999, 9999, 'select')");
24 shouldBe("element.value", "longString+'A'");
25 shouldBe("element.selectionStart", "longString.length");
26 shouldBe("element.selectionEnd", "longString.length+1");
27 shouldBe("element.scrollTop", "0");
29 runTestsShouldPass("textarea", { dir
: "rtl" });