summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/old-tests/submission/Microsoft/selection/deleteFromDocument.htm
blob: b9ae112275edf13b171c938573722ea4ccfa2fb4 (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
<!DOCTYPE HTML>
<html>
    <head>
        <title id="desc">HTML5 Selection: Delete some text from the document while it is part of a selection</title>
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>
        <script src="common.js"></script>
        <script type="text/javascript">
            function RunTest()
            {
                var selection = window.getSelection();
                var p2 = document.getElementById("p2");

                var range = document.createRange();
                range.setStart(p2.firstChild, 5);
                range.setEnd(p2.firstChild, 20);
                selection.addRange(range);

                checkSelectionAttributes(p2.firstChild, 5, p2.firstChild, 20, false, 1);
                assert_equals(p2.firstChild.data, p2.textContent)

                selection.deleteFromDocument();

                checkSelectionAttributes(p2.firstChild, 5, p2.firstChild, 5, true, 1);
                assert_equals(p2.firstChild.data, "abcdeuvwxyz")
            }
        </script>
    </head>
    <body onload="test(RunTest);">
        <p id="p1">Delete some text from the document while it is part of a selection</p>
        <p id="p2">abcdefghijklmnopqrstuvwxyz</p>
    </body>
</html>