tor-browser

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

test_copypaste.xhtml (3064B)


      1 <?xml version="1.0"?>
      2 <!--
      3 This test is copied from test_copypaste.html, but it's XHTML instead of HTML.
      4 XHTML is encoded differently from HTML when copied; see bugs 888839 and 723163.
      5 This test is different from test_copypaste.html in two ways:
      6 
      7  1. The text/html clipboard flavor isn't tested, since nsCopySupport doesn't
      8     produce it for XHTML.
      9  2. The text/plain flavor isn't tested when the selection is in hidden
     10     elements, since nsCopySupport doesn't produce text/plain for hidden
     11     elements, and unlike HTML, neither does it produce text/_moz_htmlcontext
     12     and text/_moz_htmlinfo, which the clipboard converts to text/plain.
     13 -->
     14 <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
     15 <head>
     16  <title>Test for copy/paste with XHTML</title>
     17  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     18  <script type="text/javascript" src="copypaste.js"></script>
     19  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     20 </head>
     21 <body>
     22 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=888839">Mozilla Bug 888839</a>
     23 <p id="display"></p>
     24 <div id="content" style="display: none">
     25 </div>
     26 <pre id="test">
     27 <script class="testbody" type="text/javascript">
     28 <![CDATA[
     29 
     30 function modifySelectionDiv12() {
     31  modifySelection("X<b style='display:none'>Y</b>");
     32 }
     33 
     34 SimpleTest.waitForExplicitFinish();
     35 addLoadEvent(() => {
     36  add_task(async function test_copyhtml() {
     37    await testCopyPaste(true);
     38  });
     39 });
     40 
     41 ]]>
     42 </script>
     43 </pre>
     44 <div>
     45 
     46  <div id="draggable" title="title to have a long HTML line">This is a <em>draggable</em> bit of text.</div>
     47  <textarea id="input" cols="40" rows="10"></textarea>
     48 
     49  <div id="alist">
     50    bla
     51    <ul>
     52      <li>foo</li>
     53      <li style="display: none;">baz</li>
     54      <li>bar</li>
     55    </ul>
     56  </div>
     57 
     58  <div id="blist">
     59    mozilla
     60    <ol>
     61      <li>foo</li>
     62      <li style="display: none;">baz</li>
     63      <li>bar</li>
     64    </ol>
     65  </div>
     66 
     67  <div id="clist">
     68    mzla
     69    <ul>
     70      <li>foo<ul>
     71        <li>bazzinga!</li>
     72      </ul></li>
     73      <li style="display: none;">baz</li>
     74      <li>bar</li>
     75    </ul>
     76  </div>
     77 
     78 <div id="div4">
     79  T<textarea>t t t</textarea>
     80 </div>
     81 
     82 <div id="div5">
     83  T<textarea>     </textarea>
     84 </div>
     85 
     86 <div id="div6" style="display:none"></div>
     87 <script>
     88 var x = $("div6")
     89 x.appendChild(document.createTextNode('di'))
     90 x.appendChild(document.createTextNode('v6'))
     91 </script>
     92 
     93 <div id="div7" style="display:none">div7</div>
     94 <div id="div8" style="visibility:hidden">div8</div>
     95 <div style="visibility:hidden"><div id="div9" style="visibility:visible">div9</div></div>
     96 <div style="visibility:hidden"><div><div><div id="div10"></div></div></div></div>
     97 <script>
     98 var x = $("div10")
     99 x.appendChild(document.createTextNode('div'))
    100 x.appendChild(document.createTextNode('10'))
    101 </script>
    102 
    103 <div id="div11" oncopy="modifySelection('X')"><span>div</span>11</div>
    104 <div id="div12" oncopy="modifySelectionDiv12()"><span>div</span>12</div>
    105 
    106 <div id="div13">_<noscript>FAIL</noscript>_</div>
    107 
    108 <table><tr id="tr1"><td>foo</td><td>bar</td></tr></table>
    109 
    110 </div>
    111 </body>
    112 </html>