title: What is the danger in including the same JavaScript library twice?
body: <p>One of the webapps I'm working in is made up of many partial HTML files. If the partial requires a JavaScript library such as YUI, the YUI library is included in the partial. </p>
  
  <p>When the partials are combined at runtime, the resulting HTML often includes the YUI library several times.</p>
  
  <pre><code>&lt;html&gt;
  ... 
  &lt;script type="text/javascript" src="/js/yahoo/yahoo-min.js"&gt;&lt;/script&gt;
  ... 
  &lt;script type="text/javascript" src="/js/yahoo/yahoo-min.js"&gt;&lt;/script&gt;
  ... 
  &lt;script type="text/javascript" src="/js/yahoo/yahoo-min.js"&gt;&lt;/script&gt;
  ...
  &lt;/html&gt;
  </code></pre>
  
  <p>I've seen strange behavior from including jQuery several times, especially when using AJAX. Why, specifically, is including the same JavaScript library more than once a bad idea? Why does it only sometimes cause problems?</p>