Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / paste-as-plaintext-only-has-text.html
blob853473323e24b4bfa55083cf69a4edbea384394e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 function log(s) {
6 var console = document.getElementById('console');
7 console.appendChild(document.createElement('div')).appendChild(document.createTextNode(s));
9 function startTest() {
10 if (window.testRunner)
11 testRunner.dumpAsText();
12 document.body.addEventListener('copy', onCopy);
13 document.body.addEventListener('paste', onPaste);
14 document.execCommand('Copy');
15 document.execCommand('PasteAndMatchStyle');
17 function onCopy(e) {
18 e.clipboardData.setData('text', 'Hello');
19 e.clipboardData.setData('text/html', 'World');
20 e.preventDefault();
22 function onPaste(e) {
23 log('Types: ' + e.clipboardData.types);
24 log('text/plain: "' + e.clipboardData.getData('text/plain') + '"');
25 log('text/html: "' + e.clipboardData.getData('text/html') + '"');
27 </script>
28 </head>
29 <body onload="startTest()">
30 <div>To run this test manually, simply try invoking the copy command on this
31 page followed by the paste as plain text command. If it works, text/plain should
32 be the only MIME type, 'Hello' should be associated with text/plain, and the
33 empty string should be associated with text/html.</div>
34 <div id="console"></div>
35 </body>
36 </html>