Bug 1686668 [wpt PR 27185] - Update wpt metadata, a=testonly
[gecko.git] / dom / base / test / test_bug270145.xhtml
blobebf89ef5ca02ae874ce06c59a179129039de6a76
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=270145
4 -->
5 <head>
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" />
9 </head>
10 <body>
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=270145">Mozilla Bug 270145</a>
12 <p id="display"></p>
13 <div id="content" >
14 <p id="foo"><![CDATA[a text to copy]]></p>
15 </div>
16 <pre id="test">
17 <script class="testbody" type="text/javascript">
18 //<![CDATA[
19 function testHtmlCopyEncoder () {
20 var encoder = SpecialPowers.Cu.createHTMLCopyEncoder();
21 var out, expected;
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");
39 SimpleTest.finish();
43 SimpleTest.waitForExplicitFinish();
45 addLoadEvent(testHtmlCopyEncoder);
46 //]]>
47 </script>
48 </pre>
50 </body>
51 </html>