blob: 35199a9ea4eb26e1db8f2890e52d84f709c30f30 [file] [log] [blame]
Geremy Condrac9571892012-03-05 12:32:24 -08001Tests that we don't crash when killing an text input's or textarea's renderer and then calling select.
2<textarea id="textarea1">textarea</textarea>
3<textarea id="textarea2">textarea</textarea>
4<textarea id="textarea3">textarea</textarea>
5<textarea id="textarea4">textarea</textarea>
6<input id="input1">
7<input id="input2">
8<input id="input3">
9<input id="input4">
10<script>
11 if (window.layoutTestController)
12 layoutTestController.dumpAsText();
13
14 function $(id) {
15 return document.getElementById(id);
16 }
17
18 function testSettingSelection(tagName) {
19 var id = tagName + '1';
20 $(id).style.display = "none";
21 $(id).select();
22
23 id = tagName + '2';
24 $(id).style.display = "none";
25 $(id).setSelectionRange(1, 2);
26
27 id = tagName + '3';
28 $(id).style.display = "none";
29 $(id).selectionStart = 2;
30
31 id = tagName + '4';
32 $(id).style.display = "none";
33 $(id).selectionEnd = 1;
34 }
35
36 testSettingSelection('textarea');
37 testSettingSelection('input');
38</script>