(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.copee = {}))); }(this, (function (exports) { 'use strict'; /** * Copy text to the user's clipboard */ function toClipboard(text) { // Create element and select the text const ta = document.createElement('textarea'); ta.value = text; ta.cols = 1; ta.rows = 1; ta.style.color = 'transparent'; ta.style.border = 'none'; document.body.appendChild(ta); ta.select(); let success = false; try { success = document.execCommand('copy'); } catch (err) { success = false; } // Cleanup the element we created document.body.removeChild(ta); return success; } /** * Copy text from an input/textarea element to a user's clipboard * @param el The or