title: Copy a HTML snippet of the page to a clipboard
body: <p>I am developing web development tools and I'd like to copy of a part of current web page's HTML code to the clipboard using Javascript.</p>
  
  <p>This probably would involve</p>
  
  <ul>
  <li><p>Getting the piece of HTML in the question using DOM innerHTML</p></li>
  <li><p>Copying this text to clipboard using Javascript</p></li>
  </ul>
  
  <p>Is anyone aware of any gotchas here? E.g. related to clipboard handling - when one is not using documentEditable mode do I need to create a hidden  where to put the HTML payload for copying? </p>
  
  <p>Also if possible I'd like to make the interaction with WYSIWYG components, like TinyMCE, work so that when one pastes the HTML in the visual edit mode it comes through as formatted HTML instead of plain text.</p>
  
  <p>It is enough if solution works in Chrome and Firefox. Internet Explorer does not need to be supported.</p>