title: How to provide ECMAScript 5 (ES 5)-shim?
body: <p>ECMAScript Fifth Edition (released December 2009) introduces a bunch of new methods (see <a href="http://kangax.github.com/es5-compat-table/" rel="noreferrer">this table</a> for details). However, there still are older browsers out there which do not implement those new methods. </p>
  
  <p>Luckily, there exists a convenient script (written in JavaScript) - <a href="https://github.com/kriskowal/es5-shim" rel="noreferrer">ES5-shim</a> - which implements those methods manually in environments where they don't exist.</p>
  
  <p>However, I am not sure how to provide ES5-shim... Should I just "give" it to all browsers, like so:</p>
  
  <pre><code>&lt;script src="es5-shim.js"&gt;&lt;/scipt&gt;
  </code></pre>
  
  <p>Or should I include a check in order to only "bother" those browsers which really need it, like so:</p>
  
  <pre><code>&lt;script&gt;
      if ( !Function.prototype.hasOwnProperty( 'bind' ) ) {
          (function () {
              var shim = document.createElement( 'script' );
              shim.src = 'es5-shim.js';
              var script = document.getElementsByTagName( 'script' )[0];
              script.parentNode.insertBefore( shim, script );
          }());
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>(I'm using <code>Function.prototype.bind</code> to check if a browser implements all new ECMAScript 5 methods. According to the compatibility table which I linked above, <code>bind</code> is the "last bastion" when it comes to implementing ECMAScript 5 methods.)</p>
  
  <p>Of course, for this shim to be effective, it has to be executed <em>before</em> all other scripts, which means that we want to include the above mentioned SCRIPT elements early in the page (in the HEAD, before all other SCRIPT elements).</p>
  
  <p>So, would this second example be a good way to provide ECMAScript 5-shim to browsers? Is there a better way to do it?</p>