1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=270145
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" />
11 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=270145">Mozilla Bug
270145</a>
14 <p id=
"foo"><![CDATA[a text to copy]]
></p>
17 <script class=
"testbody" type=
"text/javascript">
19 function testHtmlCopyEncoder () {
20 var encoder = SpecialPowers.Cu.createHTMLCopyEncoder();
23 var node = document.getElementById('draggable');
25 var select = window.getSelection();
26 select.removeAllRanges();
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");
43 SimpleTest.waitForExplicitFinish();
45 addLoadEvent(testHtmlCopyEncoder);