6 <p>Simple test that custom clipboard MIME types can be set during copy events
7 and retrieved during paste events. The test can be manually run by copying
8 any text on this page and then pasting anywhere. On success, the word SUCCESS
12 function copy(event
) {
13 event
.clipboardData
.setData('text', 'sample');
14 event
.clipboardData
.setData('custom-data', 'hello world');
15 event
.preventDefault();
18 function paste(event
) {
20 if (event
.clipboardData
.types
.indexOf('text/plain') < 0
21 || event
.clipboardData
.types
.indexOf('custom-data') < 0)
23 if (event
.clipboardData
.getData('text') != 'sample'
24 || event
.clipboardData
.getData('custom-data') != 'hello world')
26 document
.getElementById('log').innerText
= failed
? 'FAILURE' : 'SUCCESS';
27 event
.preventDefault();
29 document
.body
.addEventListener('copy', copy
);
30 document
.body
.addEventListener('paste', paste
);
33 if (!window
.testRunner
)
36 testRunner
.dumpAsText();
37 document
.execCommand('copy');
38 document
.execCommand('paste');