summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeRange.htm
blob: 8786e82671410497a384c6c8f738150a3919e098 (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
<!DOCTYPE HTML>
<html>
    <head>
        <title id="desc">HTML5 Selection: Remove the range from the 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 p1 = document.getElementById("p1");

                var range = document.createRange();
                range.selectNode(p1);
                selection.addRange(range);

                checkSelectionAttributes(document.body, 1, document.body, 2, false, 1);
                assert_equals(selection.toString(), p1.textContent);

                selection.removeRange(range);

                checkDefaultSelectionAttributes();
                assert_equals(selection.toString(), "");
            }
        </script>
    </head>
    <body onload="test(RunTest);">
        <p id="p1">Remove the range from the selection by calling removeRange()</p>
    </body>
</html>