title: How do I test if the element being passed to a function is the document itself?
body: <p>I'm writing a small script that injects some code into an HTML element. </p>
  
  <p>All works fine by setting:</p>
  
  <pre><code>element.innerHTML = "&lt;p&gt;foo&lt;/p&gt;";
  </code></pre>
  
  <p>unless I'm being passed the <code>document</code> itself, because both:</p>
  
  <pre><code>document.innerHTML
  </code></pre>
  
  <p>and </p>
  
  <pre><code>document[0].innerHTML
  </code></pre>
  
  <p>can't be set (at least nothing shows up on my screen :-)</p>
  
  <p><strong>Question:</strong><br>
  How can I test if the element I'm being passed is the document itself vs. the body or some other HTML element?</p>