| 52 | } |
| 53 | |
| 54 | const tinyCopy = elem => { |
| 55 | if (typeof window === 'undefined') return |
| 56 | |
| 57 | // eslint-disable-next-line |
| 58 | if (elem instanceof HTMLTextAreaElement) { |
| 59 | elem.focus() |
| 60 | elem.select() |
| 61 | execCopy() |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | // eslint-disable-next-line |
| 66 | if (elem instanceof HTMLElement || elem === document) { |
| 67 | elem = elem === document ? elem.documentElement : elem |
| 68 | return copyFromElement(elem) |
| 69 | } |
| 70 | |
| 71 | if (typeof elem === 'string') { |
| 72 | copyFromText(elem) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | module.exports = tinyCopy |
no test coverage detected