title: Should I check to see if document.getElementById is defined
body: <p>I ran across some webpage javascript code which first checks for the existence of <code>document.getElementById</code> itself before the more expected check of a particular element:</p>
  
  <pre><code>if (document.getElementById) {
      var elem = document.getElementById("someid");
      if (elem) {
          ...
      }
  }
  </code></pre>
  
  <p>Is this a reasonable practice or hyper-paranoia?  And if reasonable, why not:</p>
  
  <pre><code>if (document &amp;&amp; document.getElementById) { ... }
  </code></pre>