blob: b59585b8f84c8f4a32178a9b2469cccb78a35fdf [file] [log] [blame]
<p>This tests to make sure that copying/pasting HTML results in URLs being full paths so
pasting between websites works. To test manually, copy the selection and paste it into
the blue box. If this is a file:/// url, the links should be relative. If this is an
http:// url, the links should be absolute.</p>
<div id="test">
<a href="../relative/path/foo.html">link</a><img src="resources/abe.png">
</div>
<div id="pastehere" contenteditable="true" style="border: 1px solid blue" onpaste="paste()">
</div>
<div id="results"></div>
<script>
function test()
{
var s = window.getSelection();
var test = document.getElementById("test");
s.selectAllChildren(test);
if (!window.testRunner)
return;
testRunner.dumpAsText();
testRunner.waitUntilDone();
document.execCommand("Copy");
var pasteHere = document.getElementById("pastehere");
s.collapse(pasteHere, 0);
document.execCommand("Paste");
}
function paste()
{
setTimeout(afterPaste, 0);
}
function afterPaste()
{
var pasteHere = document.getElementById("pastehere");
var results = document.getElementById("results");
results.appendChild(document.createTextNode(pasteHere.innerHTML));
if (window.testRunner)
testRunner.notifyDone();
}
test();
</script>