title: Remove all content using pure JS
body: <p>I'm looking for a way to remove the entire content of a web page using pure Javascript -- no libraries.</p>
  
  <p>I tried:</p>
  
  <pre><code>document.documentElement.innerHTML = "whatever";
  </code></pre>
  
  <p>but that doesn't work: it replaces the inside of the <code>&lt;html/&gt;</code> element. I'm looking at replacing the entire document, including if possible the <code>doctype</code> and <code>&lt;?xml</code> declaration.</p>