tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

removeAllRanges.htm (1105B)


      1 <!DOCTYPE HTML>
      2 <html>
      3    <head>
      4        <title id="desc">HTML5 Selection: Call removeAllRanges() to clear the selection</title>
      5        <script src="/resources/testharness.js"></script>
      6        <script src="/resources/testharnessreport.js"></script>
      7        <script src="common.js"></script>
      8        <script type="text/javascript">
      9            function RunTest()
     10            {
     11                var selection = window.getSelection();
     12                var p1 = document.getElementById("p1");
     13 
     14                var range = document.createRange();
     15                range.selectNode(p1);
     16                selection.addRange(range);
     17 
     18                checkSelectionAttributes(document.body, 1, document.body, 2, false, 1);
     19                assert_equals(selection.toString(), p1.textContent);
     20 
     21                selection.removeAllRanges();
     22 
     23                checkDefaultSelectionAttributes();
     24                assert_equals(selection.toString(), "");
     25            }
     26        </script>
     27    </head>
     28    <body onload="test(RunTest);">
     29        <p id="p1">Call removeAllRanges() to clear the selection</p>
     30    </body>
     31 </html>