content/base/test/test_copypaste.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_copypaste.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,108 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<!--
     1.6 +This test is copied from test_copypaste.html, but it's XHTML instead of HTML.
     1.7 +XHTML is encoded differently from HTML when copied; see bugs 888839 and 723163.
     1.8 +This test is different from test_copypaste.html in two ways:
     1.9 +
    1.10 +  1. The text/html clipboard flavor isn't tested, since nsCopySupport doesn't
    1.11 +     produce it for XHTML.
    1.12 +  2. The text/unicode flavor isn't tested when the selection is in hidden
    1.13 +     elements, since nsCopySupport doesn't produce text/plain for hidden
    1.14 +     elements, and unlike HTML, neither does it produce text/_moz_htmlcontext
    1.15 +     and text/_moz_htmlinfo, which the clipboard converts to text/unicode.
    1.16 +-->
    1.17 +<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    1.18 +<head>
    1.19 +  <title>Test for copy/paste with XHTML</title>
    1.20 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.21 +  <script type="text/javascript" src="copypaste.js"></script>
    1.22 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.23 +</head>
    1.24 +<body>
    1.25 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=888839">Mozilla Bug 888839</a>
    1.26 +<p id="display"></p>
    1.27 +<div id="content" style="display: none">
    1.28 +</div>
    1.29 +<pre id="test">
    1.30 +<script class="testbody" type="text/javascript">
    1.31 +<![CDATA[
    1.32 +
    1.33 +function modifySelectionDiv12() {
    1.34 +  modifySelection("X<b style='display:none'>Y</b>");
    1.35 +}
    1.36 +
    1.37 +SimpleTest.waitForExplicitFinish();
    1.38 +addLoadEvent(function () testCopyPaste(true));
    1.39 +
    1.40 +]]>
    1.41 +</script>
    1.42 +</pre>
    1.43 +<div>
    1.44 +
    1.45 +  <div id="draggable" title="title to have a long HTML line">This is a <em>draggable</em> bit of text.</div>
    1.46 +  <textarea id="input" cols="40" rows="10"></textarea>
    1.47 +
    1.48 +  <div id="alist">
    1.49 +    bla
    1.50 +    <ul>
    1.51 +      <li>foo</li>
    1.52 +      <li style="display: none;">baz</li>
    1.53 +      <li>bar</li>
    1.54 +    </ul>
    1.55 +  </div>
    1.56 +
    1.57 +  <div id="blist">
    1.58 +    mozilla
    1.59 +    <ol>
    1.60 +      <li>foo</li>
    1.61 +      <li style="display: none;">baz</li>
    1.62 +      <li>bar</li>
    1.63 +    </ol>
    1.64 +  </div>
    1.65 +
    1.66 +  <div id="clist">
    1.67 +    mzla
    1.68 +    <ul>
    1.69 +      <li>foo<ul>
    1.70 +        <li>bazzinga!</li>
    1.71 +      </ul></li>
    1.72 +      <li style="display: none;">baz</li>
    1.73 +      <li>bar</li>
    1.74 +    </ul>
    1.75 +  </div>
    1.76 +
    1.77 +<div id="div4">
    1.78 +  T<textarea>t t t</textarea>
    1.79 +</div>
    1.80 +
    1.81 +<div id="div5">
    1.82 +  T<textarea>     </textarea>
    1.83 +</div>
    1.84 +
    1.85 +<div id="div6" style="display:none"></div>
    1.86 +<script>
    1.87 +var x = $("div6")
    1.88 +x.appendChild(document.createTextNode('di'))
    1.89 +x.appendChild(document.createTextNode('v6'))
    1.90 +</script>
    1.91 +
    1.92 +<div id="div7" style="display:none">div7</div>
    1.93 +<div id="div8" style="visibility:hidden">div8</div>
    1.94 +<div style="visibility:hidden"><div id="div9" style="visibility:visible">div9</div></div>
    1.95 +<div style="visibility:hidden"><div><div><div id="div10"></div></div></div></div>
    1.96 +<script>
    1.97 +var x = $("div10")
    1.98 +x.appendChild(document.createTextNode('div'))
    1.99 +x.appendChild(document.createTextNode('10'))
   1.100 +</script>
   1.101 +
   1.102 +<div id="div11" oncopy="modifySelection('X')"><span>div</span>11</div>
   1.103 +<div id="div12" oncopy="modifySelectionDiv12()"><span>div</span>12</div>
   1.104 +
   1.105 +<div id="div13">_<noscript>FAIL</noscript>_</div>
   1.106 +
   1.107 +<table><tr id="tr1"><td>foo</td><td>bar</td></tr></table>
   1.108 +
   1.109 +</div>
   1.110 +</body>
   1.111 +</html>

mercurial