Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsSupported always return false ? #666

Closed
BnitoBzh opened this issue Mar 4, 2020 · 1 comment
Closed

IsSupported always return false ? #666

BnitoBzh opened this issue Mar 4, 2020 · 1 comment

Comments

@BnitoBzh
Copy link

BnitoBzh commented Mar 4, 2020

[email protected] This issue comes from the commit 83824fa

    /**
     * Returns the support of the given action, or all actions if no action is
     * given.
     * @param {String} [action]
     */
    static isSupported(action = ['copy', 'cut']) {
        const actions = (typeof action === 'string') ? [action] : action;
        let support = !document.queryCommandSupported;
        // document.queryCommandSupported is a function, so support is always false ?
        actions.forEach((action) => {
            support = support && !document.queryCommandSupported(action);
        });

        return support;
    }

Must be

    /**
     * Returns the support of the given action, or all actions if no action is
     * given.
     * @param {String} [action]
     */
    static isSupported(action = ['copy', 'cut']) {
        const actions = (typeof action === 'string') ? [action] : action;
        let support = !!document.queryCommandSupported;

        actions.forEach((action) => {
            support = support && !!document.queryCommandSupported(action);
        });

        return support;
    }
@zenorocha
Copy link
Owner

You're totally right. Fixed in 2.0.6

cdll pushed a commit to x78w/clipboard.js that referenced this issue Jul 14, 2020
cdll added a commit to x78w/clipboard.js that referenced this issue Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants