Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / pasteboard / copy-resolves-urls.html
1 <p>This tests to make sure that copying/pasting HTML results in URLs being full paths so
2 pasting between websites works.  To test manually, copy the selection and paste it into
3 the blue box.  If this is a file:/// url, the links should be relative.  If this is an
4 http:// url, the links should be absolute.</p>
5 <div id="test">
6 <a href="../relative/path/foo.html">link</a><img src="resources/abe.png">
7 </div>
8 <div id="pastehere" contenteditable="true" style="border: 1px solid blue" onpaste="paste()">
9 </div>
10 <div id="results"></div>
11 <script>
12 function test()
13 {
14     var s = window.getSelection();
15     var test = document.getElementById("test");
16     s.selectAllChildren(test);
17
18     if (!window.testRunner)
19         return;
20     testRunner.dumpAsText();
21     testRunner.waitUntilDone();
22
23     document.execCommand("Copy");
24     var pasteHere = document.getElementById("pastehere");
25     s.collapse(pasteHere, 0);
26     document.execCommand("Paste");
27 }
28
29 function paste()
30 {
31     setTimeout(afterPaste, 0);
32 }
33
34 function afterPaste()
35 {
36     var pasteHere = document.getElementById("pastehere");
37     var results = document.getElementById("results");
38     results.appendChild(document.createTextNode(pasteHere.innerHTML));
39     if (window.testRunner)
40         testRunner.notifyDone();
41 }
42
43 test();
44 </script>