title: How to encapsulate jQuery?
body: <p>Particularly I want to define local jQuery (var jQuery) where<br>
  jQuery should be stored (and also local $).</p>
  
  <p>The problem is that jQuery operates directly with window object:</p>
  
  <pre><code>// Expose jQuery to the global object
  window.jQuery = window.$ = jQuery;
  })(window);
  </code></pre>
  
  <p>this is a citation from jQuery 1.6.4<br>
  How can I workaround this? </p>
  
  <p>P.S.: my particular problem is to write some snippet for 3-rd party website use<br>
  and if I include jQuery there may appear some incompatibilities with
  that 3-rd party js code. Currently I'm doing the following:</p>
  
  <pre><code>// here some license notes about jQuery included
  (function() {
      if (typeof jQuery === "undefined") {
          // jQuery code as it is goes here
      }
      // my code
  })(); 
  </code></pre>