Re: safeguarding a live getData() against looping scripts? (was: Re: clipboard events)

On Thu, 19 May 2011 09:43:33 +0900, João Eiras <joao.eiras@gmail.com>  
wrote:

>>> getData and setData must work outside clipboard events, like when
>>> clicking paste/copy/cut buttons on a toolbar.
>>
>> I think this is covered by execCommand('Paste') etc.
>
> But there is no way to access the clipboard contents. Or does  
> execCommand dispatch a synchronous event ?

Yes, it does. See  
http://dev.w3.org/2006/webapi/clipops/clipops.html#integration-with-other-scripts-and-events

I expect implementations to let users configure if a site/app is allowed  
to use execCommand for cut/copy/paste, perhaps with a prompt on first use.

> What if the event is prevented ? Does execCommand return false ?

I don't know much about what execCommand is meant to return, but e.g.  
doing execCommand('copy') and then event.preventDefault() from a 'copy'  
event listener is intended to prevent copying.

-- 
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/

Received on Saturday, 21 May 2011 06:38:38 UTC