Skip to content

Commit

Permalink
fix dojo/_base modules to only return the symbols they define, fixes …
Browse files Browse the repository at this point in the history
…#13208 !strict

git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@25490 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
wkeese committed Jun 10, 2011
1 parent 10fe4d3 commit 26f54a7
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 17 deletions.
10 changes: 5 additions & 5 deletions _base/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ define(["./kernel", "./array", "./lang"], function(dojo){
}
});

dojo.blendColors = function(
dojo.Color.blendColors = dojo.blendColors = function(
/*dojo.Color*/ start,
/*dojo.Color*/ end,
/*Number*/ weight,
Expand All @@ -145,7 +145,7 @@ define(["./kernel", "./array", "./lang"], function(dojo){
return t.sanitize(); // dojo.Color
};

dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
dojo.Color.fromRgb = dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
// summary:
// Returns a `dojo.Color` instance from a string of the form
// "rgb(...)" or "rgba(...)". Optionally accepts a `dojo.Color`
Expand All @@ -157,7 +157,7 @@ define(["./kernel", "./array", "./lang"], function(dojo){
return m && dojo.colorFromArray(m[1].split(/\s*,\s*/), obj); // dojo.Color
};

dojo.colorFromHex = function(/*String*/ color, /*dojo.Color?*/ obj){
dojo.Color.fromHex = dojo.colorFromHex = function(/*String*/ color, /*dojo.Color?*/ obj){
// summary:
// Converts a hex string with a '#' prefix to a color object.
// Supports 12-bit #rgb shorthand. Optionally accepts a
Expand Down Expand Up @@ -187,7 +187,7 @@ define(["./kernel", "./array", "./lang"], function(dojo){
return t; // dojo.Color
};

dojo.colorFromArray = function(/*Array*/ a, /*dojo.Color?*/ obj){
dojo.Color.fromArray = dojo.colorFromArray = function(/*Array*/ a, /*dojo.Color?*/ obj){
// summary:
// Builds a `dojo.Color` from a 3 or 4 element array, mapping each
// element in sequence to the rgb(a) values of the color.
Expand All @@ -201,7 +201,7 @@ define(["./kernel", "./array", "./lang"], function(dojo){
return t.sanitize(); // dojo.Color
};

dojo.colorFromString = function(/*String*/ str, /*dojo.Color?*/ obj){
dojo.Color.fromString = dojo.colorFromString = function(/*String*/ str, /*dojo.Color?*/ obj){
// summary:
// Parses `str` for a color value. Accepts hex, rgb, and rgba
// style color values.
Expand Down
10 changes: 9 additions & 1 deletion _base/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,13 @@ define(["./kernel", "./lang"], function(dojo){
}
});

return dojo;
return {
indexOf: dojo.indexOf,
lastIndexOf: dojo.lastIndexOf,
forEach: dojo.forEach,
every: dojo.every,
some: dojo.some,
map: dojo.map,
filter: dojo.filter
};
});
5 changes: 4 additions & 1 deletion _base/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ define(["./kernel", "../on", "../has"], function(dojo, on, has){
}
};

return dojo.connect;
return {
fixEvent: dojo.fixEvent,
stopEvent: dojo.stopEvent
};
});
11 changes: 10 additions & 1 deletion _base/fx.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,5 +655,14 @@ define(["./kernel", "./Color", "./connect", "./lang", "./html", "./sniff"], func
}).play(delay || 0);
};

return dojo.animateProperty;
return {
_Line: dojo._Line,
Animation: dojo.Animation,
_fade: dojo._fade,
fadeIn: dojo.fadeIn,
fadeOut: dojo.fadeOut,
_defaultEasing: dojo._defaultEasing,
animateProperty: dojo.animateProperty,
anim: dojo.anim
};
});
18 changes: 17 additions & 1 deletion _base/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,21 @@ define(["./kernel", "../has", "./sniff"], function(dojo, has){
map : function(_, k){ return dojo.getObject(k, false, map); });
};

return dojo;
return {
isString: dojo.isString,
isArray: dojo.isArray,
isFunction: dojo.isFunction,
isObject: dojo.isObject,
isArrayLike: dojo.isArrayLike,
isAlien: dojo.isAlien,
extend: dojo.extend,
_hitchArgs: dojo._hitchArgs,
hitch: dojo.hitch,
delegate: dojo.delegate,
_toArray: dojo._toArray,
partial: dojo.partial,
clone: dojo.clone,
trim: dojo.trim,
replace: dojo.replace
};
});
5 changes: 5 additions & 0 deletions _base/unload.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ define(["./kernel", "./connect"], function(dojo) {

dojo.connect(win, "beforeunload", obj, functionName);
};

return {
addOnWindowUnload: dojo.addOnWindowUnload,
addOnUnload: dojo.addOnUnload
};
});
24 changes: 17 additions & 7 deletions _base/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocu
// context (e.g., an iframe). The varibles dojo.global and dojo.doc
// are modified as a result of calling this function and the result of
// `dojo.body()` likewise differs.
dojo.global = globalObject;
dojo.doc = globalDocument;
dojo.global = ret.global = globalObject;
dojo.doc = ret.doc = globalDocument;
};

dojo.withGlobal = function( /*Object*/globalObject,
Expand All @@ -58,10 +58,10 @@ dojo.withGlobal = function( /*Object*/globalObject,

var oldGlob = dojo.global;
try{
dojo.global = globalObject;
dojo.global = ret.global = globalObject;
return dojo.withDoc.call(null, globalObject.document, callback, thisObject, cbArguments);
}finally{
dojo.global = oldGlob;
dojo.global = ret.global = oldGlob;
}
};

Expand All @@ -82,7 +82,7 @@ dojo.withDoc = function( /*DocumentElement*/documentObject,
oldQ = dojo.isQuirks;

try{
dojo.doc = documentObject;
dojo.doc = ret.doc = documentObject;
delete dojo._bodyLtr; // uncache
dojo.isQuirks = dojo.doc.compatMode == "BackCompat"; // no need to check for QuirksMode which was Opera 7 only

Expand All @@ -92,12 +92,22 @@ dojo.withDoc = function( /*DocumentElement*/documentObject,

return callback.apply(thisObject, cbArguments || []);
}finally{
dojo.doc = oldDoc;
dojo.doc = ret.doc = oldDoc;
delete dojo._bodyLtr; // in case it was undefined originally, and set to true/false by the alternate document
if(oldLtr !== undefined){ dojo._bodyLtr = oldLtr; }
dojo.isQuirks = oldQ;
}
};

return dojo;
var ret = {
global: dojo.global,
doc: dojo.doc,
body: dojo.body,
setContext: dojo.setContext,
withGlobal: dojo.withGlobal,
withDoc: dojo.withDoc
};

return ret;

});
23 changes: 22 additions & 1 deletion _base/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,5 +979,26 @@ define(["./kernel", "../has", "require", "../on", "./sniff", "./Deferred", "./js
}
*/

return dojo.xhr;
// Add aliases for static functions to dojo.xhr since dojo.xhr is what's returned from this module
dojo.mixin(dojo.xhr, {
_xhrObj: dojo._xhrObj,
fieldToObject: dojo.fieldToObject,
formToObject: dojo.formToObject,
objectToQuery: dojo.objectToQuery,
formToQuery: dojo.formToQuery,
formToJson: dojo.formToJson,
queryToObject: dojo.queryToObject,
contentHandlers: handlers,
_ioSetArgs: dojo._ioSetArgs,
_ioCancelAll: dojo._ioCancelAll,
_ioNotifyStart: dojo._ioNotifyStart,
_ioWatch: dojo._ioWatch,
_ioAddQueryToUrl: dojo._ioAddQueryToUrl,
get: dojo.xhrGet,
post: dojo.xhrPost,
put: dojo.xhrPut,
del: dojo.xhrDelete // because "delete" is a reserved word
});

return dojo.xhr;
});

0 comments on commit 26f54a7

Please sign in to comment.