From 51fcd5f6622c9828797bd234d014bae637bddee0 Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Sun, 26 Aug 2018 16:03:26 -0700 Subject: [PATCH] Attempt IE strategy second. This allows `clipboard-polyfill` to work in modern browsers even if `window.clipboardData` and `window.clipboardData.setData` are defined for some reason. --- clipboard-polyfill.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clipboard-polyfill.ts b/clipboard-polyfill.ts index 18981fb..01d79cf 100644 --- a/clipboard-polyfill.ts +++ b/clipboard-polyfill.ts @@ -43,15 +43,6 @@ export default class ClipboardPolyfill { "to suppress this warning."); } - // Internet Explorer - if (seemToBeInIE()) { - if (writeIE(data)) { - return; - } else { - throw "Copying failed, possibly because the user rejected it."; - } - } - if (execCopy(data)) { debugLog("regular execCopy worked"); return; @@ -64,6 +55,15 @@ export default class ClipboardPolyfill { return; } + // Internet Explorer + if (seemToBeInIE()) { + if (writeIE(data)) { + return; + } else { + throw "Copying failed, possibly because the user rejected it."; + } + } + // Fallback 1 for desktop Safari. if (copyUsingTempSelection(document.body, data)) { debugLog("copyUsingTempSelection worked");