diff --git a/dist/clipboard.js b/dist/clipboard.js index d7ce0ad..2fd2d92 100644 --- a/dist/clipboard.js +++ b/dist/clipboard.js @@ -125,7 +125,7 @@ var ClipboardActionCopy = function ClipboardActionCopy(target) { if (typeof target === 'string') { selectedText = fakeCopyAction(target, options); - } else if (!['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) { + } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) { // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange selectedText = fakeCopyAction(target.value, options); } else { diff --git a/dist/clipboard.min.js b/dist/clipboard.min.js index be81377..a3aa4f4 100644 --- a/dist/clipboard.min.js +++ b/dist/clipboard.min.js @@ -4,4 +4,4 @@ * * Licensed MIT © Zeno Rocha */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1 { it('should select its value in a input number based on text', () => { const value = 1; - document.querySelector('input').setAttribute('type', 'number'); - document.querySelector('input').setAttribute('value', value); + document.querySelector('#input').setAttribute('type', 'number'); + document.querySelector('#input').setAttribute('value', value); const selectedText = ClipboardActionCopy( - document.querySelector('input'), + document.querySelector('#input'), { container: document.body, }