Chrome Version:69.0.3473.0 (Official Build) dev (64-bit)
What steps will reproduce the problem?
(1) https://drop-test.glitch.me/
(2) CTRL-C - will raise the oncopy event
(3) CTRL-V - will raise the onpaste event
What is the expected result?
I would expect the file to remain attached to the clipboardEvent.files object so
that I can use it again in my web app.
document.documentElement.addEventListener('copy', (event) => {
const file = new File(['hello world'], 'testing.txt', {type: 'text/plain'});
event.clipboardData.items.add(file);
event.preventDefault();
});
document.documentElement.addEventListener('paste', (event) => {
console.log(event.clipboardData.files.length); // == 0
console.log(event.clipboardData.items.length); // == 1 .. the name of the file.
})
What happens instead?
clipboardData.files is empty, it should contain the file. The spec implies that this would be what is expected.
It's impossible to paste content that was generated by the origin back into the origin.
Comment 1 by paulkin...@google.com
, Jul 5