Compare commits

...

2 Commits

Author SHA1 Message Date
Zeno Rocha
fddd2aac5f 2.0.6 2020-03-04 22:26:34 -08:00
Zeno Rocha
e430d056ad Fix "isSupported" behavior - Closes #666 2020-03-04 22:24:24 -08:00
7 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "2.0.5",
"version": "2.0.6",
"description": "Modern copy to clipboard. No Flash. Just 3kb",
"license": "MIT",
"main": "dist/clipboard.js",

6
dist/clipboard.js vendored
View File

@@ -1,5 +1,5 @@
/*!
* clipboard.js v2.0.5
* clipboard.js v2.0.6
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
@@ -936,10 +936,10 @@ var clipboard_Clipboard = function (_Emitter) {
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
var actions = typeof action === 'string' ? [action] : action;
var support = !document.queryCommandSupported;
var support = !!document.queryCommandSupported;
actions.forEach(function (action) {
support = support && !document.queryCommandSupported(action);
support = support && !!document.queryCommandSupported(action);
});
return support;

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
Package.describe({
name: "zenorocha:clipboard",
summary: "Modern copy to clipboard. No Flash. Just 3kb.",
version: "2.0.5",
version: "2.0.6",
git: "https://github.com/zenorocha/clipboard.js"
});

View File

@@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "2.0.5",
"version": "2.0.6",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"repository": "zenorocha/clipboard.js",
"license": "MIT",

View File

@@ -86,10 +86,10 @@ class Clipboard extends Emitter {
*/
static isSupported(action = ['copy', 'cut']) {
const actions = (typeof action === 'string') ? [action] : action;
let support = !document.queryCommandSupported;
let support = !!document.queryCommandSupported;
actions.forEach((action) => {
support = support && !document.queryCommandSupported(action);
support = support && !!document.queryCommandSupported(action);
});
return support;

View File

@@ -110,12 +110,12 @@ describe('Clipboard', () => {
describe('#static isSupported', () => {
it('should return the support of the given action', () => {
assert.equal(Clipboard.isSupported('copy'), false);
assert.equal(Clipboard.isSupported('cut'), false);
assert.equal(Clipboard.isSupported('copy'), true);
assert.equal(Clipboard.isSupported('cut'), true);
});
it('should return the support of the cut and copy actions', () => {
assert.equal(Clipboard.isSupported(), false);
assert.equal(Clipboard.isSupported(), true);
});
});