Skip to content

Commit

Permalink
fixes #12200 #12199, refs #11869 #11893, !strict
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@23633 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
rcgill committed Jan 24, 2011
1 parent 91a4688 commit 4830000
Show file tree
Hide file tree
Showing 29 changed files with 599 additions and 109 deletions.
2 changes: 1 addition & 1 deletion _base/Color.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/Color", ["dojo", "dojo/_base/array", "dojo/_base/lang"], function(dojo) {
define("dojo/_base/Color", ["dojo/lib/kernel", "dojo/_base/array", "dojo/_base/lang"], function(dojo){

(function(){

Expand Down
2 changes: 1 addition & 1 deletion _base/Deferred.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/Deferred", ["dojo", "dojo/_base/lang"], function(dojo) {
define("dojo/_base/Deferred", ["dojo/lib/kernel", "dojo/_base/lang"], function(dojo){

(function(){
var mutator = function(){};
Expand Down
2 changes: 1 addition & 1 deletion _base/NodeList.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/NodeList", ["dojo", "dojo/_base/lang", "dojo/_base/array", "dojo/_base/connect", "dojo/_base/html"], function(dojo) {
define("dojo/_base/NodeList", ["dojo/lib/kernel", "dojo/_base/lang", "dojo/_base/array", "dojo/_base/connect", "dojo/_base/html"], function(dojo){

//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
(function(){
Expand Down
84 changes: 67 additions & 17 deletions _base/_loader/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//>>includeStart("amdLoader", kwArgs.asynchLoader);
(function(){

function bootstrapDojo(dojo, dijit, dojox){

//>>includeEnd("amdLoader");
/*=====
// note:
// 'djConfig' does not exist under 'dojo.*' so that it can be set before the
Expand Down Expand Up @@ -163,23 +169,14 @@ djConfig = {
//TODOC: HOW TO DOC THIS?
// dojo is the root variable of (almost all) our public symbols -- make sure it is defined.
if(typeof dojo == "undefined"){
if(typeof require == "function"){
// loaded by another module loader like RequireJS
dojo = require("dojo");
define("dojo/_base/_loader/bootstrap", [], dojo);
}else{
// Dojo is the module loader
define = function(id, deps, factory){factory(dojo)};
define.dojo = true;
dojo = {};
}
dojo._scopeName = "dojo";
dojo._scopePrefix = "";
dojo._scopePrefixArgs = "";
dojo._scopeSuffix = "";
dojo._scopeMap = {};
dojo._scopeMapRev = {};

dojo = {
_scopeName: "dojo",
_scopePrefix: "",
_scopePrefixArgs: "",
_scopeSuffix: "",
_scopeMap: {},
_scopeMapRev: {}
};
}

var d = dojo;
Expand Down Expand Up @@ -513,3 +510,56 @@ dojo.global = {
})();
//>>excludeEnd("webkitMobile");
// vim:ai:ts=4:noet
//>>includeStart("amdLoader", kwArgs.asynchLoader);

return {dojo:dojo, dijit:dijit, dojox:dojox};
}

// This resource ("bootstrap") is responsible for creating and starting to populate the
// dojo, dijit, and dojox objects. With the introduction of AMD loading, there are
// several ways bootstrap could be evaluated:
//
// 1. Consequent to dojo.js script-injecting it. In this case it is expected to be
// evaluated immediately and dojo, dijit, and dojox are expected to be located
// in the global namespace. Note that if bootstrap is injected by dojo.js, then
// an AMD loader is *not* being used.
//
// 2. Consequent to an AMD loader script-injecting it. In this case, it is expected
// to delay evaluation, and instead publish a factory function to be executed under
// the control of the AMD loader. IAW AMD loader design, the global space should
// not be polluted; therefore dojo, dijit, and dojox are not be published into
// the global space.
//
// 3. Consequent to a built version of dojo (sync or xdomain loader).
//
// For [1], a bootstrap version of define is provided below. the v1.6 sync loader
// will replace this with a better AMD simulation. The bootstrap version ensures bootstrap
// is executed immediately--just as with all dojo versions prior to v1.6.
//
// For [2], a factory function is provided to the loader that executes the bootstrap
// without polluting the global namespace. The factory returns the dojo object, and the
// dijit and dojox objects are stuffed into the dojo object (at _dijit and _dojox) so
// that dojo, dijit, and dojox bootstraps used with AMD can retrieve and control these
// objects.
//
// For [3], the build util with v1.6 strips *all* AMD artifacts from this resource and reverts it
// to look like v1.5. This ensures the built version, with either the sync or xdomain loader, work
// *exactly* as in v1.5. While it may be possible to do more, any solution that does not
// include significant work on the build util is likely to introduce edge cases that fail. Therefore
// this work is delayed for 1.7 when a AMD-capable built util will be provided.

if(!this.define){
// bootstrapping dojo with sync loader; dojo, dijit, and dojox go into the global space
var result = bootstrapDojo();
dojo = result.dojo;
dijit = result.dijit;
dojox = result.dojox;
}else{
// bootstrapping dojo with an AMD loader
define([], function(){
return bootstrapDojo().dojo;
});
}

})();
//>>includeEnd("amdLoader");
16 changes: 15 additions & 1 deletion _base/_loader/hostenv_browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
//>>includeStart("amdLoader", kwArgs.asynchLoader);
define(["dojo/lib/backCompat"], function(dojo){
// Note: if this resource is being loaded *without* an AMD loader, then
// it is loaded by dojo.js which injects it into the doc with a script element. The simulated
// AMD define function in _loader.js will cause the factory to be executed.
//
// The build util with v1.6 strips all AMD artifacts from this resource and reverts it
// to look like v1.5. This ensures the built version, with either the sync or xdomain loader, work
// *exactly* as in v1.5.

//>>includeEnd("amdLoader");
/*=====
dojo.isBrowser = {
// example:
Expand Down Expand Up @@ -64,7 +75,6 @@ dojo = {
// True if the client runs on Mac
}
=====*/
define("dojo/_base/_loader/hostenv_browser", ["./loader"], function(){
//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
if(typeof window != 'undefined'){
//>>excludeEnd("webkitMobile");
Expand Down Expand Up @@ -486,4 +496,8 @@ if(dojo.config.debugAtAllCosts){
dojo.require("dojo._base._loader.loader_debug");
dojo.require("dojo.i18n");
}

//>>includeStart("amdLoader", kwArgs.asynchLoader);
return dojo;
});
//>>includeEnd("amdLoader");
60 changes: 33 additions & 27 deletions _base/_loader/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* all of the package loading methods.
*/
//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
define("dojo/_base/_loader/loader", ["./bootstrap"], function(){
(function(){
var d = dojo, currentModule;
//>>excludeEnd("webkitMobile");

Expand Down Expand Up @@ -802,21 +802,12 @@ define("dojo/_base/_loader/loader", ["./bootstrap"], function(){
}

return new d._Url(loc, url); // dojo._Url
}
};

//addition to support script-inject module format
var originalDefine = this.define;
define = !originalDefine.dojo ?
function(name, obj){
// an existing define is already defined, need to hook into define callbacks
if(typeof name == "string"){
if(/dojo|dijit/.test(name)){
dojo.provide(name.replace(/\//g, "."));
}
}
return originalDefine.apply(this, arguments);
} :
function(name, deps, def){
//>>includeStart("amdLoader", kwArgs.asynchLoader);
// addition to support AMD module format
// replace the bootstrap define function (defined in _base/boostrap.js) with the dojo v1.x simulated AMD loader...
define= function(name, deps, def){
if(!def){
// less than 3 args
if(deps){
Expand Down Expand Up @@ -860,15 +851,26 @@ define("dojo/_base/_loader/loader", ["./bootstrap"], function(){
}else{
var arg;
switch(depName){
case "require": arg = function(relativeId){
return dojo.require(resolvePath(relativeId));
}; break;
case "exports": arg = exports; break;
case "module": var module = arg = {exports: exports}; break;
case "require":
arg = function(relativeId){
return dojo.require(resolvePath(relativeId));
};
break;
case "exports":
arg = exports;
break;
case "module":
var module = arg = {exports: exports};
break;
case "dojox":
arg = dojo.getObject(depName);
break;
default: arg = dojo.require(depName);
break;
case "dojo/lib/kernel":
case "dojo/lib/backCompat":
arg = dojo;
break;
default:
arg = dojo.require(depName);
}
}
args.push(arg);
Expand All @@ -888,11 +890,15 @@ define("dojo/_base/_loader/loader", ["./bootstrap"], function(){
return returned;

};
define("dojo", [], d);
define.vendor = "dojotoolkit.org";
define.version = dojo.version;
define("dojo/lib/kernel", [], dojo);
define("dojo/lib/backCompat", [], dojo);
define("dojo", [], dojo);
define("dijit", [], this.dijit || (this.dijit = {}));
define("dojo/_base/_loader/loader",[],{});
dojo.simulatedLoading = 1;
//>>includeEnd("amdLoader");


//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
});
})();
//>>excludeEnd("webkitMobile");
13 changes: 0 additions & 13 deletions _base/_loader/package-main.js

This file was deleted.

2 changes: 1 addition & 1 deletion _base/array.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/array", ["dojo", "dojo/_base/lang"], function(dojo) {
define("dojo/_base/array", ["dojo/lib/kernel", "dojo/_base/lang"], function(dojo){

//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
(function(){
Expand Down
2 changes: 1 addition & 1 deletion _base/connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/connect", ["dojo", "dojo/_base/lang"], function(dojo) {
define("dojo/_base/connect", ["dojo/lib/kernel", "dojo/_base/lang"], function(dojo){

// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA

Expand Down
2 changes: 1 addition & 1 deletion _base/declare.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/declare", ["dojo", "dojo/_base/lang", "dojo/_base/array"], function(dojo) {
define("dojo/_base/declare", ["dojo/lib/kernel", "dojo/_base/lang", "dojo/_base/array"], function(dojo){

(function(){
var d = dojo, mix = d._mixin, op = Object.prototype, opts = op.toString,
Expand Down
2 changes: 1 addition & 1 deletion _base/event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/event", ["dojo", "dojo/_base/connect"], function(dojo) {
define("dojo/_base/event", ["dojo/lib/kernel", "dojo/_base/connect"], function(dojo){

// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA

Expand Down
2 changes: 1 addition & 1 deletion _base/fx.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/fx", ["dojo", "dojo/_base/Color", "dojo/_base/connect", "dojo/_base/lang", "dojo/_base/html"], function(dojo) {
define("dojo/_base/fx", ["dojo/lib/kernel", "dojo/_base/Color", "dojo/_base/connect", "dojo/_base/lang", "dojo/_base/html"], function(dojo){

/*
Animation loosely package based on Dan Pupius' work, contributed under CLA:
Expand Down
2 changes: 1 addition & 1 deletion _base/html.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/html", ["dojo", "dojo/_base/lang"], function(dojo) {
define("dojo/_base/html", ["dojo/lib/kernel", "dojo/_base/lang"], function(dojo){

// FIXME: need to add unit tests for all the semi-public methods

Expand Down
2 changes: 1 addition & 1 deletion _base/json.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/json", ["dojo"], function(dojo) {
define("dojo/_base/json", ["dojo/lib/kernel"], function(dojo){

dojo.fromJson = function(/*String*/ json){
// summary:
Expand Down
2 changes: 1 addition & 1 deletion _base/lang.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/lang", ["dojo"], function(dojo) {
define("dojo/_base/lang", ["dojo/lib/kernel"], function(dojo){

(function(){
var d = dojo, opts = Object.prototype.toString;
Expand Down
40 changes: 20 additions & 20 deletions _base/query.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
(function() {
(function(){

/*
dojo.query() architectural overview:
Expand Down Expand Up @@ -1576,25 +1576,25 @@ var defineAcme= function(){
};

//prefers queryPortability, then acme, then dojo
if (this["dojo"]) {
var defined= 0;
//>>includeStart("asyncLoader", kwArgs.asynchLoader);
defined= 1;
define("dojo/_base/query", ["dojo", "dojo/_base/NodeList", "dojo/_base/lang"], function(dojo) {
defineQuery(this["queryPortability"]||this["acme"]||dojo);
});
//>>includeEnd("asyncLoader");
//>>excludeStart("asyncLoader", kwArgs.asynchLoader);
if (!defined) {
// must be in a built version that stripped out the define above
dojo.provide("dojo._base.query");
dojo.require("dojo._base.NodeList");
dojo.require("dojo._base.lang");
defineQuery(this["queryPortability"]||this["acme"]||dojo);
} // else must be in a source version (or a build that likes define)
//>>excludeEnd("asyncLoader");
} else {
defineQuery(this["queryPortability"]||this["acme"]||defineAcme());
if(this["dojo"]){
var defined = 0;
//>>includeStart("amdLoader", kwArgs.asynchLoader);
defined = 1;
define("dojo/_base/query", ["dojo/lib/kernel", "dojo/_base/NodeList", "dojo/_base/lang", "dojo/_base/window"], function(dojo){
defineQuery(this["queryPortability"]||this["acme"]||dojo);
});
//>>includeEnd("amdLoader");
//>>excludeStart("amdLoader", kwArgs.asynchLoader);
if(!defined){
// must be in a built version that stripped out the define above
dojo.provide("dojo._base.query");
dojo.require("dojo._base.NodeList");
dojo.require("dojo._base.lang");
defineQuery(this["queryPortability"]||this["acme"]||dojo);
} // else must be in a source version (or a build that likes define)
//>>excludeEnd("amdLoader");
}else{
defineQuery(this["queryPortability"]||this["acme"]||defineAcme());
}

})();
Expand Down
2 changes: 1 addition & 1 deletion _base/window.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/window", ["dojo"], function(dojo) {
define("dojo/_base/window", ["dojo/lib/kernel"], function(dojo){

/*=====
dojo.doc = {
Expand Down
2 changes: 1 addition & 1 deletion _base/xhr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("dojo/_base/xhr", ["dojo", "dojo/_base/Deferred", "dojo/_base/json", "dojo/_base/lang", "dojo/_base/query"], function(dojo) {
define("dojo/_base/xhr", ["dojo/lib/kernel", "dojo/_base/Deferred", "dojo/_base/json", "dojo/_base/lang", "dojo/_base/query"], function(dojo){

//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
(function(){
Expand Down
Loading

0 comments on commit 4830000

Please sign in to comment.