summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css-generated-content/crash-selection-editing-removes-pseudo.html
blob: 18e3374f396e969e1d29e421a017fdc5f7e479db (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
<!DOCTYPE html>

<style>
    #before:before {
        /* must be an inline-block */
        display: inline-block;
        content: 'before';
    }
    #start:after {
        /* must be an inline-block */
        display: inline-block;
        content: 'after';
    }
</style>


<p>Passes if it doesn't crash.</p>

<div id="test">
    <span id="before"><!-- no content can be here --></span>
    <span>text</span>
    <span id="start"><!-- no content can be here --></span>
</div>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

var before = document.getElementById('before');
var start = document.getElementById('start');
var test = document.getElementById('test');

// Select from the #start backwards to the start of the line.
window.getSelection().setBaseAndExtent(document.getElementById('start'));
window.getSelection().modify('extend', 'backward', 'lineBoundary')

// Replace the selection with a break. This replaces #before, text,
// #start with two <br>'s.
document.designMode = 'on';
document.execCommand('InsertLineBreak');

// Crash during tear down.
test.innerHTML = "Both pseudos have been removed: " + (before.offsetHeight == 0 && start.offsetHeight == 0);
</script>