Ticket #4573: dojo.2.patch

File dojo.2.patch, 8.7 kB (added by jburke, 15 months ago)

Patch for dojo core repo, done against r11084

  • io/script.js

     
    5656                var dfd = dojo._ioSetArgs(args, this._deferredCancel, this._deferredOk, this._deferredError); 
    5757 
    5858                var ioArgs = dfd.ioArgs; 
    59                 ioArgs.id = "dojoIoScript" + (this._counter++); 
     59                ioArgs.id = dojo._scopeName + "IoScript" + (this._counter++); 
    6060                ioArgs.canDelete = false; 
    6161 
    6262                //Special setup for jsonp case 
  • io/iframe.js

     
    128128                //              using dojo.objectToQuery(). 
    129129 
    130130                if(!this["_frame"]){ 
    131                         this._frame = this.create(this._iframeName, "dojo.io.iframe._iframeOnload();"); 
     131                        this._frame = this.create(this._iframeName, dojo._scopeName + ".io.iframe._iframeOnload();"); 
    132132                } 
    133133 
    134134                //Set up the deferred. 
     
    212212 
    213213        _currentDfd: null, 
    214214        _dfdQueue: [], 
    215         _iframeName: "dojoIoIframe", 
     215        _iframeName: dojo._scopeName + "IoIframe", 
    216216 
    217217        _fireNextRequest: function(){ 
    218218                //summary: Internal method used to fire the next request in the bind queue. 
  • parser.js

     
    122122                //              potentially calls a layout method to allow them to connect with 
    123123                //              any children             
    124124                var thelist = []; 
     125                var daName = dojo._scopeName + "Type"; 
    125126                d.forEach(nodes, function(node){ 
    126127                        if(!node){ return; } 
    127                         var type = node.getAttribute("dojoType"); 
     128                        var type = node.getAttribute(daName); 
    128129                        if((!type)||(!type.length)){ return; } 
    129130                        var clsInfo = getClassInfo(type); 
    130131                        var clazz = clsInfo.cls; 
     
    219220                //              Search specified node (or root node) recursively for class instances, 
    220221                //              and instantiate them Searches for 
    221222                //              dojoType="qualified.class.name" 
    222                 var list = d.query('[dojoType]', rootNode); 
     223                var list = d.query('[' + dojo._scopeName + 'Type]', rootNode); 
    223224                // go build the object instances 
    224225                var instances = this.instantiate(list); 
    225226                return instances; 
  • _base/_loader/loader.js

     
    112112        if(!contents){ return false; } // Boolean 
    113113        this._loadedUrls[uri] = true; 
    114114        this._loadedUrls.push(uri); 
    115         if(cb){ contents = '('+contents+')'; } 
     115        if(cb){ 
     116                contents = '('+contents+')'; 
     117        }else{ 
     118                //Only do the scoping if no callback. If a callback is specified, 
     119                //it is most likely the i18n bundle stuff. 
     120                contents = this._scopePrefix + contents + this._scopeSuffix; 
     121        } 
    116122        var value = dojo["eval"](contents+"\r\n//@ sourceURL="+uri); 
    117123        if(cb){ cb(value); } 
    118124        return true; // Boolean 
     
    223229        //FF 2.0 and freezing issues where we try to do sync xhr while background css images 
    224230        //are being loaded (trac #2572)? Consider for 0.9. 
    225231        if(typeof setTimeout == "object" || (djConfig["useXDomain"] && dojo.isOpera)){ 
    226                 setTimeout("dojo.loaded();", 0); 
     232                setTimeout(dojo._scopeName + ".loaded();", 0); 
    227233        }else{ 
    228234                dojo.loaded(); 
    229235        } 
  • _base/_loader/hostenv_browser.js

     
    238238                        //      strips all comments -- including conditional ones. 
    239239 
    240240                        document.write('<scr'+'ipt defer src="//:" ' 
    241                                 + 'onreadystatechange="if(this.readyState==\'complete\'){dojo._loadInit();}">' 
     241                                + 'onreadystatechange="if(this.readyState==\'complete\'){' + dojo._scopeName + '._loadInit();}">' 
    242242                                + '</scr'+'ipt>' 
    243243                        ); 
    244244 
  • _base/_loader/loader_debug.js

     
    1212                //Set a timeout so the module can be executed into existence. Normally the 
    1313                //dojo.provide call in a module is the first line. Don't want to risk attaching 
    1414                //another script tag until the current one finishes executing. 
    15                 window.setTimeout("dojo._xdDebugFileLoaded('" + resourceName + "')", 1); 
     15                window.setTimeout(dojo._scopeName + "._xdDebugFileLoaded('" + resourceName + "')", 1); 
    1616        } 
    1717 
    1818        return dojo.nonDebugProvide.apply(dojo, arguments); 
  • _base/_loader/bootstrap.js

     
    4141 
    4242        //TODOC:  HOW TO DOC THIS? 
    4343        // dojo is the root variable of (almost all) our public symbols -- make sure it is defined. 
    44         if(typeof this["dojo"] == "undefined"){ 
    45                 this.dojo = {}; 
     44        if(typeof(dojo) == "undefined"){ 
     45                this.dojo = { 
     46                        _scopeName: "dojo", 
     47                        _scopePrefix: "", 
     48                        _scopePrefixArgs: "", 
     49                        _scopeSuffix: "", 
     50                        _scopeMap: {} 
     51                }; 
    4652        } 
    4753 
     54        //Need placeholders for dijit and dojox for scoping code. 
     55        if(typeof(dijit) == "undefined"){ 
     56                this.dijit = {_scopeName: "dijit"}; 
     57        } 
     58        if(typeof(dojox) == "undefined"){ 
     59                this.dojox = {_scopeName: "dojox"}; 
     60        } 
     61 
     62        if(!dojo._scopeArgs){ 
     63                dojo._scopeArgs = [dojo, dijit, dojox]; 
     64        } 
     65 
    4866        // summary: 
    4967        //              return the current global context object 
    5068        //              (e.g., the window object in a browser). 
     
    91109 
    92110// Register with the OpenAjax hub 
    93111if(typeof OpenAjax != "undefined"){ 
    94         OpenAjax.hub.registerLibrary("dojo", "http://dojotoolkit.org", dojo.version.toString()); 
     112        OpenAjax.hub.registerLibrary(dojo._scopeName, "http://dojotoolkit.org", dojo.version.toString()); 
    95113} 
    96114 
    97115dojo._getProp = function(/*Array*/parts, /*Boolean*/create, /*Object*/context){ 
    98116        var obj=context||dojo.global; 
    99117        for(var i=0, p; obj&&(p=parts[i]); i++){ 
     118                if(i == 0 && this._scopeMap[p]){ 
     119                        p = this._scopeMap[p]; 
     120                } 
    100121                obj = (p in obj ? obj[p] : (create ? obj[p]={} : undefined)); 
    101122        } 
    102123        return obj; // Any 
  • _base/_loader/loader_xd.js

     
    4545 
    4646        //Create resource object and the call to _xdResourceLoaded. 
    4747        var output = []; 
    48         output.push("dojo._xdResourceLoaded({\n"); 
     48        output.push(dojo._scopeName + "._xdResourceLoaded({\n"); 
    4949 
    5050        //Add dependencies 
    5151        if(deps.length > 0){ 
     
    6060        } 
    6161 
    6262        //Add the contents of the file inside a function. 
    63         //Pass in dojo as an argument to the function to help with 
    64         //allowing multiple versions of dojo in a page. 
    65         output.push("\ndefineResource: function(dojo){"); 
     63        //Pass in scope arguments so we can support multiple versions of the 
     64        //same module on a page. 
     65        output.push("\ndefineResource: function(" + dojo._scopePrefixArgs + "){"); 
    6666         
    6767        //Don't put in the contents in the debugAtAllCosts case 
    6868        //since the contents may have syntax errors. Let those 
     
    168168 
    169169                //Start timer 
    170170                if(!this._xdTimer){ 
    171                         this._xdTimer = setInterval("dojo._xdWatchInFlight();", 100); 
     171                        this._xdTimer = setInterval(dojo._scopeName + "._xdWatchInFlight();", 100); 
    172172                } 
    173173                this._xdStartTime = (new Date()).getTime(); 
    174174        } 
     
    213213                        var res = this._xdCreateResource(contents, module, uri); 
    214214                        dojo.eval(res); 
    215215                }else{ 
    216                         if(cb){ contents = '('+contents+')'; } 
    217                         var value = dojo.eval(contents); 
    218216                        if(cb){ 
     217                                contents = '('+contents+')'; 
     218                        }else{ 
     219                                //Only do the scoping if no callback. If a callback is specified, 
     220                                //it is most likely the i18n bundle stuff. 
     221                                contents = this._scopePrefix + contents + this._scopeSuffix; 
     222                        } 
     223                        var value = dojo["eval"](contents+"\r\n//@ sourceURL="+uri); 
     224                        if(cb){ 
    219225                                cb(value); 
    220226                        } 
    221227                } 
     
    593599                        this._xdDebugQueue.push({resourceName: content.resourceName, resourcePath: content.resourcePath}); 
    594600                }else{ 
    595601                        //Evaluate the resource to bring it into being. 
    596                         //Pass dojo in so that later, to support multiple versions of dojo 
    597                         //in a page, we can pass which version of dojo to use.   
    598                         content(dojo); 
     602                        //Pass in scope args to allow multiple versions of modules in a page.    
     603                        content.apply(dojo.global, dojo._scopeArgs); 
    599604                } 
    600605        } 
    601606 
     
    603608        //This normally shouldn't happen with proper dojo.provide and dojo.require 
    604609        //usage, but providing it just in case. Note that these may not be executed 
    605610        //in the original order that the developer intended. 
    606         //Pass dojo in so that later, to support multiple versions of dojo 
    607         //in a page, we can pass which version of dojo to use. 
    608611        for(var i = 0; i < this._xdContents.length; i++){ 
    609612                var current = this._xdContents[i]; 
    610613                if(current.content && !current.isDefined){ 
    611                         current.content(dojo); 
     614                        //Pass in scope args to allow multiple versions of modules in a page.    
     615                        current.content.apply(dojo.global, dojo._scopeArgs); 
    612616                } 
    613617        } 
    614618