blob: e3d230139aee9e66a575e4b112cb2560011897be [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
table, td {
border: solid 1px #8bb8f4;
border-collapse: collapse;
}
</style>
</head>
<body onpaste="setTimeout(dump, 0)" contenteditable="true">
<p>This tests pasting into a table cell.
To manually run the test, copy the text below and paste it into the first text cell after the non-breaking space.
The content should be pasted into the first cell, not between two tds.</p>
<div id="source">Drag me</div>
<div id="result"><table width="400"><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table></div>
<script src="../../resources/dump-as-markup.js"></script>
<script>
var source = document.getElementById('source');
getSelection().selectAllChildren(source);
document.execCommand('copy', false, null);
Markup.description(document.querySelector('p').textContent);
Markup.waitUntilDone();
function dump() {
Markup.dump('result', '"Drag me" should appear inside the first td');
Markup.notifyDone();
}
if (document.queryCommandEnabled('paste')) {
getSelection().setPosition(document.querySelector('td').firstChild, 1);
document.execCommand('paste', false, null);
}
</script>
</body>
</html>