From 57a26dfdc5793058a2f6a17d69cbac6d046d6925 Mon Sep 17 00:00:00 2001 From: pk Date: Sun, 12 Jul 2026 10:17:35 +0200 Subject: [PATCH] Remove dead code and provide the return value for error detection. --- clipboard.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/clipboard.js b/clipboard.js index c223da2..d189047 100644 --- a/clipboard.js +++ b/clipboard.js @@ -1,23 +1,16 @@ export const clipboard = function(superClass) { return class extends superClass { copy(content) { - copyToClipboard(content); + return copyToClipboard(content); } }; }; export const copyToClipboard = async (content) => { - const txtEl = document.createElement('input'); - txtEl.type = 'hidden'; - document.body.appendChild(txtEl); - txtEl.value = content; - try { await navigator.clipboard.writeText(content); return true; } catch (err) { return false; - } finally { - document.body.removeChild(txtEl); } }