- From: Hallvord R. M. Steen <hsteen@mozilla.com>
- Date: Tue, 20 May 2014 03:11:20 -0700 (PDT)
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: public-webapps <public-webapps@w3.org>
On Mon, May 19, 2014 at 9:21 PM, Hallvord R. M. Steen
<hsteen@mozilla.com> wrote:
>> button.onclick = function(){
>> button.dispatchEvent(new ClipboardEvent('copy', {dataType:'text/plain', data:'Hello world'});
>> // did that succeed or not? We don't have event.clipboardData on a clip event object
> That should never work as per the other thread.
Per the other thread I accept that a copy event should not cause a default action in the UA - for example, if you've selected 'hi world' in the web page, calling
document.body.dispatchEvent(new ClipboardEvent('copy'))
will not place 'hi world' on the clipboard - because scripted events do not have default actions.
However, if a scripted copy event can't take a payload and have it placed on the clipboard, what's the point of making script-generated copy events possible in the first place? If there's no point I'd rather disallow them.
> execCommand should maybe work. And with the various queryCommand*
> APIs you can do detection.
Detection is still tricky. Are you suggesting that
document.queryCommandEnabled('copy')
should return true when called from a trusted click event but false when called inline in a script, to indicate that this command is only available in semi-trusted events?
-Hallvord
Received on Tuesday, 20 May 2014 10:11:47 UTC