title: Copy string to clipboard, without using a DOM element?
body: <p>I have this code that works:</p>
  
  <pre><code>let textarea = document.createElement('textarea');
  textarea.setAttribute('type', 'hidden');
  textarea.textContent = 'the string you want to copy';
  document.body.appendChild(textarea);
  textarea.select();
  document.execCommand('copy');
  </code></pre>
  
  <p>as you can see - I have the string to copy in hand. But I have to create a temporary hidden DOM element to score the string before copying to the clipboard.</p>
  
  <p>My question is, is there some API to copy to clipboard without needing the DOM at all? something like this:</p>
  
  <pre><code>document.execCommand('copy', 'the string data to put in clipboard');
  </code></pre>
  
  <p>seems weird that the DOM is necessary to do this. Also, as a side note, this clipboard API is super strange, anyone else agree?</p>