title: picking jQuery 1.9 or 2.0 using JavaScript and Require.JS
body: <p>jQuery 2.0 is increasingly mature: <a href="http://blog.jquery.com/2013/03/01/jquery-2-0-beta-2-released/">http://blog.jquery.com/2013/03/01/jquery-2-0-beta-2-released/</a></p>
  
  <p>jQuery 2.0 breaks compatibility with older browsers, so one must know when to stay with jQuery 1.9. The recommended approach is to use IE's conditional comments:</p>
  
  <pre><code>&lt;!--[if lt IE 9]&gt;
      &lt;script src="jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;![endif]--&gt;
  &lt;!--[if gte IE 9]&gt;&lt;!--&gt;
      &lt;script src="jquery-2.0.0b2.js"&gt;&lt;/script&gt;
  &lt;!--&lt;![endif]--&gt;
  </code></pre>
  
  <ul>
  <li><p>current web development best-practice suggests that we should be avoiding browser-sniffing or user agent string parsing, but isn't this sort of what conditional comments are?</p></li>
  <li><p>does jQuery 2.0 only break compatibility with older Internet Explorer? or are there other browsers that will be worse off in 2.0?</p></li>
  <li><p>if this affects more than just Internet Explorer (which is the only place conditional comments work), then what strategy should we use for selecting the best jQuery?</p></li>
  <li><p>is there a globally-accessible value/object/function/etc in the JavaScript environment whose presence can be used to signal compatibility with jQuery 2.0 (e.g. a feature-detect)?</p></li>
  </ul>
  
  <h2>main question</h2>
  
  <p>My projects currently use Require.JS to modularise my code. My code currently loads jQuery only when it encounters the first section that requires it.</p>
  
  <p><strong>What is the best way to load the correct version of jQuery using Require.JS?</strong></p>
  
  <p>I'm currently considering:</p>
  
  <ul>
  <li><p>using the IE conditional comments before I load Require.JS, then "defining" jQuery manually afterwards</p></li>
  <li><p>using a JS feature-detect in the code that sets Require.JS's paths (before anything require's jQuery) setting the path to 1.9 or 2.0 as appropriate (my preferred method)</p></li>
  <li><p>always using 1.9 no matter what (the safest and most boring approach)</p></li>
  </ul>