on execCommand() and script-triggered copy/cut/paste

Hi,
I've always assumed that the Clipboard API spec would/should integrate with
document.execCommand() and use its "commands" to trigger scripted copying
and cutting (and, if UAs implement relevant permissions, pasting). See
http://www.whatcouldbewrong.com/articles/html5-clipboard-support/
for a description.

Now, since I filed https://github.com/w3c/editing/issues/61 I've been
reminded that execCommand() is considered deprecated.

Some thoughts:
1) I think "deprecated" is not a useful classification because I don't
think execCommand() can ever be removed from UAs. It's in too wide use.
Frankly, even if we in a couple of years have a fully developed "editing
intentions" spec and in another year or two browser implementations and
libraries using it, there will be millions and millions of sites that won't
upgrade anytime soon. Quite a few of them never will.

(Your spec is (obviously) at an early stage - for example it describes a
deleteContent intention but doesn't explain how to pass the direction of
the delete action to the JS listener.)

2) With your proposal (contenteditable intentions) it seems you have no
parts at all that will require the UA to do some work in response to a
script - but if you want to handle the use case "have custom buttons for
clipboard actions" you'll need some way to integrate with the UA.

I suggest that rather than reinventing a way to send "commands", you
un-deprecate execCommand() but deprecate individual commands for use with
contenteditable = intents. (Sounds like you would deprecate all legacy
commands but cut/copy/paste.)
-Hallvord

Received on Tuesday, 4 August 2015 13:22:38 UTC