I need to programmatically create a ClipboardEvent instance in Chrome.
But when I run the constructor:
new ClipboardEvent("paste", {dataType: "text/plain", data: "some data"})
It throws the following error:
Uncaught TypeError: Illegal constructor
The constructor works as intended in Firefox.
Checked MDN and W3C spec and they don't mention anything about it being illegal to create instances of ClipboardEvent.
Is it possible to create an instance of ClipboardEvent in Chrome in any other way? I prefer to not mock a custom ClipboardEvent when one exists.
Update 2018-07-17: Using the ClipboardEvent seems to work in Chrome 69.
Unfortunately, it's not. This is from http://caniuse.com/#feat=clipboard
Unfortunately, the only browser that properly supports the
Clipboard API
is FireFox (since 22). All other browsers (if it supports Clipboard API at all), will not support the ClipbordEvent constructor.