[clipboard] queryCommandEnabled() and before* events

Hi,
I've just reported https://github.com/w3c/clipboard-apis/issues/4 - pasting
text below:

 Through onbefore* events, JS can ensure copy/cut/paste UI in the browsers
is enabled even if there is no selection or editable context. However,
unless we spec queryCommandEnabled() to fire onbefore* events and return
true if those are prevented, we risk that queryCommandEnabled() returns
false even when the UI gets enabled and the actions are in fact available.

Proposal: the clipboard-apis spec can write an "enabledness check"
algorithm which the editing spec
<https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#querycommandenabled%28%29>
can hook into.

The enabledness check will be spec'ed roughly like this:
1) Fire one onbefore event on document
2) When any event handler(s) are done, check if the default action was
prevented/return value was false. If this is the case, return true for
"enabledness check"
3) Otherwise, fall back to the implementation's default logic.

Criticism welcome.
 -Hallvord

Received on Friday, 8 May 2015 11:21:53 UTC