fixed typo (easeout); added check if jQuery._$ even exists, added examples for usage...
[jquery.git] / src / jquery / jquery.js
index 5aa2130..c551041 100644 (file)
@@ -1063,12 +1063,47 @@ jQuery.extend = jQuery.fn.extend = function() {
 
 jQuery.extend({
        /**
+        * Run this function to give control of the $ variable back
+        * to whichever library first implemented it. This helps to make 
+        * sure that jQuery doesn't conflict with the $ object
+        * of other libraries.
+        *
+        * By using this function, you will only be able to access jQuery
+        * using the 'jQuery' variable. For example, where you used to do
+        * $("div p"), you now must do jQuery("div p").
+        *
+        * @example $.noConflict();
+        * @desc Maps the original object that was referenced by $ back to $
+        *
+        * @example $.noConflict();
+        * (function($) { 
+        *   $(function() {
+        *     // more code using $ as alias to jQuery
+        *   });
+        * })(jQuery);
+        * // other code using $ as an alias to the original implementation (not jQuery)
+        * @desc Reverts the $ alias and then creates and executes a
+        * function to provide the $ as a jQuery alias inside the functions
+        * scope. Inside the function the original $ object is not available.
+        * This works well for most plugins that don't rely on any other library.
+        * 
+        *
+        * @name noConflict
+        * @type undefined
+        * @cat Core 
+        */
+       noConflict: function() {
+               if(jQuery._$)
+                       $ = jQuery._$;
+       },
+       
+       /**
         * @private
         * @name init
         * @type undefined
         * @cat Core
         */
-       init: function(){
+       init: function() {
                jQuery.initDone = true;
 
                jQuery.each( jQuery.macros.axis, function(i,n){