blob: 853473323e24b4bfa55083cf69a4edbea384394e [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function log(s) {
var console = document.getElementById('console');
console.appendChild(document.createElement('div')).appendChild(document.createTextNode(s));
}
function startTest() {
if (window.testRunner)
testRunner.dumpAsText();
document.body.addEventListener('copy', onCopy);
document.body.addEventListener('paste', onPaste);
document.execCommand('Copy');
document.execCommand('PasteAndMatchStyle');
}
function onCopy(e) {
e.clipboardData.setData('text', 'Hello');
e.clipboardData.setData('text/html', 'World');
e.preventDefault();
}
function onPaste(e) {
log('Types: ' + e.clipboardData.types);
log('text/plain: "' + e.clipboardData.getData('text/plain') + '"');
log('text/html: "' + e.clipboardData.getData('text/html') + '"');
}
</script>
</head>
<body onload="startTest()">
<div>To run this test manually, simply try invoking the copy command on this
page followed by the paste as plain text command. If it works, text/plain should
be the only MIME type, 'Hello' should be associated with text/plain, and the
empty string should be associated with text/html.</div>
<div id="console"></div>
</body>
</html>