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