W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

[clipboard] queryCommandEnabled() and before* events

From: Hallvord Reiar Michaelsen Steen <hsteen@mozilla.com>
Date: Fri, 8 May 2015 13:21:25 +0200
Message-ID: <CAE3JC2y_uz8a73AvLnZ0L2K_bKVKjMgnbc6YThaf05kOOPnz6w@mail.gmail.com>
To: WebApps WG <public-webapps@w3.org>
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

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC