From 8feb0ec27e5d14ffda3c143e376c3c8c474e22ea Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Tue, 20 Aug 2024 22:17:14 -0700 Subject: [PATCH] Remove ClipboardItem fallback ClipboardItem is supported on all modern web browsers as of June 2024 --- index.html | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 0a2f7db..6ec6f9e 100644 --- a/index.html +++ b/index.html @@ -479,16 +479,11 @@ }); document.querySelector('#copy-table').addEventListener('click', e => { - if (window.ClipboardItem === undefined) { - navigator.clipboard.writeText(table.innerText); - } - else { - const data = [new ClipboardItem({ - 'text/plain': new Blob([table.innerText], { type: 'text/plain' }), - 'text/html': new Blob([`${table.outerHTML}`], { type: 'text/html' }) - })]; - navigator.clipboard.write(data); - } + const data = [new ClipboardItem({ + 'text/plain': new Blob([table.innerText], { type: 'text/plain' }), + 'text/html': new Blob([`${table.outerHTML}`], { type: 'text/html' }) + })]; + navigator.clipboard.write(data); debounceButton(e.target, icons['clipboard'], 'Copy table to clipboard'); }); -- 2.47.3