tor-browser

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

test_bug270145.xhtml (1332B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=270145
      4 -->
      5 <head>
      6  <title>Test the html copy encoder with XHTML </title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      9 </head>
     10 <body>
     11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=270145">Mozilla Bug 270145</a>
     12 <p id="display"></p>
     13 <div id="content" >
     14 <p id="foo"><![CDATA[a text to copy]]></p>
     15 </div>
     16 <pre id="test">
     17 <script class="testbody" type="text/javascript">
     18 //<![CDATA[
     19 function testHtmlCopyEncoder () {
     20  var encoder = SpecialPowers.Cu.createHTMLCopyEncoder();
     21  var out, expected;
     22  
     23  var node = document.getElementById('draggable');
     24 
     25  var select = window.getSelection();
     26  select.removeAllRanges();
     27 
     28  node = document.getElementById("foo").firstChild;
     29  var range = document.createRange();
     30  range.setStart(node, 0);
     31  range.setEnd(node, "a text to copy".length);
     32  select.addRange(range);
     33  encoder.init(document, "text/html", 0);
     34  encoder.setSelection(select);
     35  out = encoder.encodeToString();
     36  expected = "a text to copy";
     37  is(out, expected, "test xhtml copy");
     38 
     39  SimpleTest.finish();
     40 }
     41 
     42 
     43 SimpleTest.waitForExplicitFinish();
     44 
     45 addLoadEvent(testHtmlCopyEncoder);
     46 //]]>
     47 </script>
     48 </pre>
     49 
     50 </body>
     51 </html>