Skip to content

Commit

Permalink
Attempt IE strategy second.
Browse files Browse the repository at this point in the history
This allows `clipboard-polyfill` to work in modern browsers even if
`window.clipboardData` and `window.clipboardData.setData` are defined
for some reason.
  • Loading branch information
lgarron committed Aug 26, 2018
1 parent ad2bb1f commit 51fcd5f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions clipboard-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down

0 comments on commit 51fcd5f

Please sign in to comment.