blob: 702c2b29e4a26cae0ef9f10717a30198ca0c0bb3 [file] [log] [blame]
<div id="test">This test verifies that we can get text/html from the clipboard
during an onpaste event. This test requires DRT.</div>
<div id="target" contenteditable onpaste="paste(event)">
Paste content in this div.
</div>
<div id="results">FAIL</div>
<script src="../editing.js"></script>
<script>
var undefined;
function removeFontName(text)
{
if (!text)
return text;
return text.replace(/font-family: [^;]+;\s*/g, "");
}
function paste(ev)
{
console.log("text/plain: " + ev.clipboardData.getData("text/plain"));
// Remove the font name because it varies depending on the platform.
console.log("text/html: " + ev.clipboardData.getData("text/html").replace(/style="[^"]+"/, 'style="..."'));
if (ev.clipboardData.getData("text/html") != undefined)
document.getElementById("results").innerHTML = "PASS";
}
function editingTest()
{
var selection = window.getSelection();
selection.modify("extend", "forward", "sentence");
copyCommand();
var elem = document.getElementById("target");
selection.setPosition(elem, 0);
selection.modify("move", "forward", "sentence");
pasteCommand();
}
runDumpAsTextEditingTest(false);
</script>