title: Is a <head> element always available in the DOM, even if absent in the HTML markup?
body: <p>Every browser I've observed creates a <code>&lt;head&gt;</code> element that's accessible in the DOM even if there are no explicit <code>&lt;head&gt;&lt;/head&gt;</code> tags in the document's markup.</p>
  
  <p>However, Google Analytics uses the following code for dynamic script insertion:</p>
  
  <pre><code>(function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  })();
  </code></pre>
  
  <p>The following line:</p>
  
  <pre><code>(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  </code></pre>
  
  <p>seems to make a special concession for cases where a <code>&lt;head&gt;</code> element is not present.</p>
  
  <p>Is this just a case of extreme backwards-compatibility (e.g., for Netscape 4, or the like), or is there a case to be made for not assuming that modern browsers (i.e., Internet Explorer 6 and more recent) will always have access to a <code>&lt;head&gt;</code> element in the DOM?</p>