Bug Tracker

Changeset 2833

Show
Ignore:
Timestamp:
08/22/07 05:44:47 (1 year ago)
Author:
jeresig
Message:

Made 'jQuery' unrollable via .noConflict(true) and instances of new Function() have been converted to eval(function(){}) in order to handle jQuery name changes. (Bug #1393)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/jquery/jquery.js

    r2821 r2833  
    2020 * @cat Core 
    2121 */ 
     22 
     23// Map over jQuery in case of overwrite 
     24if ( typeof jQuery != "undefined" ) 
     25    var _jQuery = jQuery; 
     26 
    2227var jQuery = window.jQuery = function(a,c) { 
    2328    // If the context is global, return a new object 
     
    3035// Map over the $ in case of overwrite 
    3136if ( typeof $ != "undefined" ) 
    32     jQuery._$ = $; 
     37    var _$ = $; 
    3338     
    3439// Map the jQuery namespace to the '$' one 
     
    13461351     * @cat Core  
    13471352     */ 
    1348     noConflict: function() { 
    1349         if ( jQuery._$ ) 
    1350             $ = jQuery._$; 
     1353    noConflict: function(deep) { 
     1354        window.$ = _$; 
     1355        if ( deep ) 
     1356            window.jQuery = _jQuery; 
    13511357        return jQuery; 
    13521358    }, 
     
    18521858        // for it (a handy shortcut) 
    18531859        if ( typeof fn == "string" ) 
    1854             fn = new Function("a","i","return " + fn); 
     1860            fn = eval("function(a,i){return " + fn + "}"); 
    18551861 
    18561862        var result = []; 
     
    19061912        // for it (a handy shortcut) 
    19071913        if ( typeof fn == "string" ) 
    1908             fn = new Function("a","return " + fn); 
     1914            fn = eval("function(a){return " + fn + "}"); 
    19091915 
    19101916        var result = [];