Closed
Bug 1211191
Opened 10 years ago
Closed 10 years ago
document.queryCommandSupported('cut'/'copy') also returns true for not user-initiated code
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: grobinson, Unassigned)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
|
1.14 KB,
text/html
|
Details |
According to the current MDN docs on document.queryCommandSupported [0], "The 'cut' and 'copy' commands returns true only from user-initiated or privileged code." I've attached a test case that allows you to test the return value for document.queryCommandSupported('copy') from both non-user-initiated and user-initiated actions.
On Firefox 41.0.1, document.queryCommandSupported('copy') returns "true" from *both* user-initiated and non-user-initiated actions. This is actually preferable from a developer's perspective, since it allows them to configure their UI (e.g. add or remove a "Copy to Clipboard" button) without requiring the user to interact with the page first. It also appears to be the intention of Bug 1162952. However, it is inconsistent with the documentation on MDN.
Additionally, it is inconsistent with the behavior of Chrome (tested: 45.0.2454.101). In Chrome, document.queryCommandSupported('copy') only returns "True" if the action is user-initiated.
[0] https://developer.mozilla.org/en-US/docs/Web/API/Document/queryCommandSupported
| Reporter | ||
Comment 1•10 years ago
|
||
Adding "blocks 1162952" by request of Aryx on #developers.
Blocks: 1162952
Updated•10 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: document.queryCommandSupported('cut'/'copy') inconsistent with Chrome → document.queryCommandSupported('cut'/'copy') also returns true for not user-initiated code
Updated•10 years ago
|
Keywords: dev-doc-needed
Comment 2•10 years ago
|
||
Chrome is wrong. The idea and logic we're currently aiming for is this:
* queryCommandSupported() should return true since the command is implemented
* queryCommandEnabled() should return true in contexts where the command actually *is* enabled (i.e. in user-initiated threads or scripts that have special permissions in some other implementation-specific way, i.e. IE's site whitelisting).
https://code.google.com/p/chromium/issues/detail?id=476508
https://code.google.com/p/chromium/issues/detail?id=475868
I will fix MDN.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•