summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/text-control-crash-on-select.html
blob: 1202599592992de3e888b82817fc0b21d7cef59a (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
Tests that we don't crash when killing an text input's or textarea's renderer and then calling select.
<textarea id="textarea1">textarea</textarea>
<textarea id="textarea2">textarea</textarea>
<textarea id="textarea3">textarea</textarea>
<textarea id="textarea4">textarea</textarea>
<input id="input1">
<input id="input2">
<input id="input3">
<input id="input4">
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    function $(id) {
        return document.getElementById(id);
    }

    function testSettingSelection(tagName) {
        var id = tagName + '1';
        $(id).style.display = "none";
        $(id).select();

        id = tagName + '2';
        $(id).style.display = "none";
        $(id).setSelectionRange(1, 2);

        id = tagName + '3';
        $(id).style.display = "none";
        $(id).selectionStart = 2;

        id = tagName + '4';
        $(id).style.display = "none";
        $(id).selectionEnd = 1;
    }
    
    testSettingSelection('textarea');
    testSettingSelection('input');
</script>