- From: Anne van Kesteren <annevk@annevk.nl>
- Date: Tue, 20 May 2014 12:48:14 +0200
- To: "Hallvord R. M. Steen" <hsteen@mozilla.com>
- Cc: public-webapps <public-webapps@w3.org>
On Tue, May 20, 2014 at 12:40 PM, Hallvord R. M. Steen <hsteen@mozilla.com> wrote: > It seems somewhat confusing to generate copy events that notify listeners about something that won't happen. But I guess this is a philosophical problem that is common for all synthetic events, except the click one. How is it true for click? <!DOCTYPE html> <a href="http://example.org/">wut</a> <script>document.querySelector("a").dispatchEvent(new Event("click"))</script> Does not cause a navigate action. This does: <script>document.querySelector("a").click()</script> > Calling document.execCommand('copy') will by itself dispatch a "copy" event. Yes. It initiates a copy action. As part of that action an event is dispatched to inform listeners and allow them to interfere with the action flow. But confusing the two is very wrong. An end-user moving the mouse is an action, the mousemove event is just a result of that action and does not actually cause the mouse to move. > I wonder how fancy we can get with execCommand()'s value argument? Could we go for something like this instead of the scripted event payload? > > document.execCommand('copy', false, {'text/plain':'Hello', 'text/html':'<p><b>Hello</b></p>'}); ? Maybe, or we could propose a new API. -- http://annevankesteren.nl/
Received on Tuesday, 20 May 2014 10:48:41 UTC