title: Copy the string with `\n` use document.execCommand("copy")
body: <p>I can copy a text use bellow function, create a dummy node, and remove it after copied:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function copyToClipboard(text){
          var dummy = document.createElement("textarea");
          document.body.appendChild(dummy);
          dummy.setAttribute('value', text);
          dummy.select();
          document.execCommand("copy");
          document.body.removeChild(dummy);
      }
      copyToClipboard('Hello, World! \nJames')</code></pre>
  </div>
  </div>
  </p>
  
  <p>but I find a issue, it can not copy the string with <code>\n</code>. how to solve this issue?</p>