content/base/test/test_copypaste.xhtml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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:
     7   1. The text/html clipboard flavor isn't tested, since nsCopySupport doesn't
     8      produce it for XHTML.
     9   2. The text/unicode 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/unicode.
    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 type="text/javascript" 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[
    30 function modifySelectionDiv12() {
    31   modifySelection("X<b style='display:none'>Y</b>");
    32 }
    34 SimpleTest.waitForExplicitFinish();
    35 addLoadEvent(function () testCopyPaste(true));
    37 ]]>
    38 </script>
    39 </pre>
    40 <div>
    42   <div id="draggable" title="title to have a long HTML line">This is a <em>draggable</em> bit of text.</div>
    43   <textarea id="input" cols="40" rows="10"></textarea>
    45   <div id="alist">
    46     bla
    47     <ul>
    48       <li>foo</li>
    49       <li style="display: none;">baz</li>
    50       <li>bar</li>
    51     </ul>
    52   </div>
    54   <div id="blist">
    55     mozilla
    56     <ol>
    57       <li>foo</li>
    58       <li style="display: none;">baz</li>
    59       <li>bar</li>
    60     </ol>
    61   </div>
    63   <div id="clist">
    64     mzla
    65     <ul>
    66       <li>foo<ul>
    67         <li>bazzinga!</li>
    68       </ul></li>
    69       <li style="display: none;">baz</li>
    70       <li>bar</li>
    71     </ul>
    72   </div>
    74 <div id="div4">
    75   T<textarea>t t t</textarea>
    76 </div>
    78 <div id="div5">
    79   T<textarea>     </textarea>
    80 </div>
    82 <div id="div6" style="display:none"></div>
    83 <script>
    84 var x = $("div6")
    85 x.appendChild(document.createTextNode('di'))
    86 x.appendChild(document.createTextNode('v6'))
    87 </script>
    89 <div id="div7" style="display:none">div7</div>
    90 <div id="div8" style="visibility:hidden">div8</div>
    91 <div style="visibility:hidden"><div id="div9" style="visibility:visible">div9</div></div>
    92 <div style="visibility:hidden"><div><div><div id="div10"></div></div></div></div>
    93 <script>
    94 var x = $("div10")
    95 x.appendChild(document.createTextNode('div'))
    96 x.appendChild(document.createTextNode('10'))
    97 </script>
    99 <div id="div11" oncopy="modifySelection('X')"><span>div</span>11</div>
   100 <div id="div12" oncopy="modifySelectionDiv12()"><span>div</span>12</div>
   102 <div id="div13">_<noscript>FAIL</noscript>_</div>
   104 <table><tr id="tr1"><td>foo</td><td>bar</td></tr></table>
   106 </div>
   107 </body>
   108 </html>

mercurial