Skip to content

Commit

Permalink
Fix dijit/_base API doc, in particular only show the symbols exported…
Browse files Browse the repository at this point in the history
… by each module, even if the module (for back-compat reasons) is returning dijit itself. Refs #13101 !strict.
  • Loading branch information
wkeese committed Jul 11, 2012
1 parent f0db9e2 commit 56ead81
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 106 deletions.
9 changes: 7 additions & 2 deletions _Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ define([

// module:
// dijit/_Calendar
// summary:
// Deprecated widget, used dijit/Calendar instead. Will be removed in 2.0.

/*=====
return {
// summary:
// Deprecated widget, used dijit/Calendar instead. Will be removed in 2.0.
};
=====*/

kernel.deprecated("dijit._Calendar is deprecated", "dijit._Calendar moved to dijit.Calendar", 2.0);

Expand Down
16 changes: 10 additions & 6 deletions _base/focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ define([

// module:
// dijit/_base/focus
// summary:
// Deprecated module to monitor currently focused node and stack of currently focused widgets.
// New code should access dijit/focus directly.

lang.mixin(dijit, {
var exports = {
// summary:
// Deprecated module to monitor currently focused node and stack of currently focused widgets.
// New code should access dijit/focus directly.

// _curFocus: DomNode
// Currently focused item on screen
_curFocus: null,
Expand Down Expand Up @@ -245,7 +246,7 @@ define([

handle && handle.remove();
}
});
};

// Override focus singleton's focus function so that dijit.focus()
// has backwards compatible behavior of restoring selection (although
Expand Down Expand Up @@ -315,5 +316,8 @@ define([
topic.publish("widgetFocus", widget, by); // publish
});

return dijit;
lang.mixin(dijit, exports);

/*===== return exports; =====*/
return dijit; // for back compat :-(
});
66 changes: 12 additions & 54 deletions _base/manager.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,35 @@
define([
"dojo/_base/array",
"dojo/_base/config", // defaultDuration
/*===== "dojo/_base/lang", =====*/
"dojo/_base/lang",
"../registry",
"../main" // for setting exports to dijit namespace
], function(array, config, /*===== lang, =====*/ registry, dijit){
], function(array, config, lang, registry, dijit){

// module:
// dijit/_base/manager
// summary:
// Shim to methods on registry, plus a few other declarations.
// New code should access dijit/registry directly when possible.

/*=====
dijit.byId = function(id){
var exports = {
// summary:
// Returns a widget by it's id, or if passed a widget, no-op (like dom.byId())
// id: String|dijit._Widget
return registry.byId(id); // dijit/_WidgetBase
// Deprecated. Shim to methods on registry, plus a few other declarations.
// New code should access dijit/registry directly when possible.
};

dijit.getUniqueId = function(widgetType){
// summary:
// Generates a unique id for a given widgetType
// widgetType: String
return registry.getUniqueId(widgetType); // String
};
dijit.findWidgets = function(root){
// summary:
// Search subtree under root returning widgets found.
// Doesn't search for nested widgets (ie, widgets inside other widgets).
// root: DOMNode
return registry.findWidgets(root);
};
dijit._destroyAll = function(){
// summary:
// Code to destroy all widgets and do other cleanup on page unload
return registry._destroyAll();
};
dijit.byNode = function(node){
// summary:
// Returns the widget corresponding to the given DOMNode
// node: DOMNode
return registry.byNode(node); // dijit/_WidgetBase
};
dijit.getEnclosingWidget = function(node){
// summary:
// Returns the widget whose DOM tree contains the specified DOMNode, or null if
// the node is not contained within the DOM tree of any widget
// node: DOMNode
return registry.getEnclosingWidget(node);
};
=====*/
array.forEach(["byId", "getUniqueId", "findWidgets", "_destroyAll", "byNode", "getEnclosingWidget"], function(name){
dijit[name] = registry[name];
exports[name] = registry[name];
});

dijit.defaultDuration = config["defaultDuration"] || 200;
/*=====
lang.mixin(dijit, {
lang.mixin(exports, {
// defaultDuration: Integer
// The default fx.animation speed (in ms) to use for all Dijit
// transitional fx.animations, unless otherwise specified
// on a per-instance basis. Defaults to 200, overrided by
// `djConfig.defaultDuration`
defaultDuration: 200
defaultDuration: config["defaultDuration"] || 200
});
=====*/

return dijit;
lang.mixin(dijit, exports);

/*===== return exports; =====*/
return dijit; // for back compat :-(
});
48 changes: 21 additions & 27 deletions _base/place.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,36 @@
define([
"dojo/_base/array", // array.forEach
"dojo/_base/lang", // lang.isArray
"dojo/_base/lang", // lang.isArray, lang.mixin
"dojo/window", // windowUtils.getBox
"../place",
"../main" // export to dijit namespace
], function(array, lang, windowUtils, place, dijit){

// module:
// dijit/_base/place
// summary:
// Back compatibility module, new code should use dijit/place directly instead of using this module.

dijit.getViewport = function(){

var exports = {
// summary:
// Deprecated back compatibility module, new code should use dijit/place directly instead of using this module.
};

exports.getViewport = function(){
// summary:
// Deprecated method to return the dimensions and scroll position of the viewable area of a browser window.
// New code should use windowUtils.getBox()

return windowUtils.getBox();
};

/*=====
dijit.placeOnScreen = function(node, pos, corners, padding){
// summary:
// Positions one of the node's corners at specified position
// such that node is fully visible in viewport.
// Deprecated, new code should use dijit.place.at() instead.
};
=====*/
dijit.placeOnScreen = place.at;
exports.placeOnScreen = place.at;

/*=====
dijit.placeOnScreenAroundElement = function(node, aroundElement, aroundCorners, layoutNode){
exports.placeOnScreenAroundElement = function(node, aroundNode, aroundCorners, layoutNode){
// summary:
// Like dijit.placeOnScreenAroundNode(), except it accepts an arbitrary object
// for the "around" argument and finds a proper processor to place a node.
// Deprecated, new code should use dijit.place.around() instead.
};
=====*/
dijit.placeOnScreenAroundElement = function(node, aroundNode, aroundCorners, layoutNode){

// Convert old style {"BL": "TL", "BR": "TR"} type argument
// to style needed by dijit.place code:
// [
Expand All @@ -57,33 +50,32 @@ define([
return place.around(node, aroundNode, positions, true, layoutNode);
};

exports.placeOnScreenAroundNode = exports.placeOnScreenAroundElement;
/*=====
dijit.placeOnScreenAroundNode = function(node, aroundNode, aroundCorners, layoutNode){
exports.placeOnScreenAroundNode = function(node, aroundNode, aroundCorners, layoutNode){
// summary:
// Position node adjacent or kitty-corner to aroundNode
// such that it's fully visible in viewport.
// Deprecated, new code should use dijit.place.around() instead.
};
=====*/
dijit.placeOnScreenAroundNode = dijit.placeOnScreenAroundElement;

exports.placeOnScreenAroundRectangle = exports.placeOnScreenAroundElement;
/*=====
dijit.placeOnScreenAroundRectangle = function(node, aroundRect, aroundCorners, layoutNode){
exports.placeOnScreenAroundRectangle = function(node, aroundRect, aroundCorners, layoutNode){
// summary:
// Like dijit.placeOnScreenAroundNode(), except that the "around"
// parameter is an arbitrary rectangle on the screen (x, y, width, height)
// instead of a dom node.
// Deprecated, new code should use dijit.place.around() instead.
};
=====*/
dijit.placeOnScreenAroundRectangle = dijit.placeOnScreenAroundElement;

dijit.getPopupAroundAlignment = function(/*Array*/ position, /*Boolean*/ leftToRight){
exports.getPopupAroundAlignment = function(/*Array*/ position, /*Boolean*/ leftToRight){
// summary:
// Deprecated method, unneeded when using dijit/place directly.
// Transforms the passed array of preferred positions into a format suitable for
// passing as the aroundCorners argument to dijit.placeOnScreenAroundElement.
//
// position: String[]
// This variable controls the position of the drop down.
// It's an array of strings with the following values:
Expand All @@ -97,10 +89,9 @@ define([
//
// The list is positions is tried, in order, until a position is found where the drop down fits
// within the viewport.
//
// leftToRight: Boolean
// Whether the popup will be displaying in leftToRight mode.
//

var align = {};
array.forEach(position, function(pos){
var ltr = leftToRight;
Expand Down Expand Up @@ -133,5 +124,8 @@ define([
return align;
};

return dijit;
lang.mixin(dijit, exports);

/*===== return exports; =====*/
return dijit; // for back compat :-(
});
9 changes: 7 additions & 2 deletions _base/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ define([

// module:
// dijit/_base/popup
// summary:
// Old module for popups, new code should use dijit/popup directly

/*=====
return {
// summary:
// Deprecated. Old module for popups, new code should use dijit/popup directly.
};
=====*/


// Hack support for old API passing in node instead of a widget (to various methods)
Expand Down
9 changes: 7 additions & 2 deletions _base/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ define([
], function(windowUtils, dijit){
// module:
// dijit/_base/scroll
// summary:
// Back compatibility module, new code should use windowUtils directly instead of using this module.

/*=====
return {
// summary:
// Back compatibility module, new code should use windowUtils directly instead of using this module.
};
=====*/

dijit.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
// summary:
Expand Down
10 changes: 8 additions & 2 deletions _base/sniff.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
define([ "dojo/uacss" ], function(){

// module:
// dijit/_base/sniff
// summary:
// Back compatibility module, new code should require dojo/uacss directly instead of this module.

/*=====
return {
// summary:
// Deprecated, back compatibility module, new code should require dojo/uacss directly instead of this module.
};
=====*/
});
9 changes: 8 additions & 1 deletion _base/typematic.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
define(["../typematic"], function(){
// for back-compat, just loads top level module

/*=====
return {
// summary:
// Deprecated, for back-compat, just loads top level module
};
=====*/

});
20 changes: 12 additions & 8 deletions _base/wai.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ define([

// module:
// dijit/_base/wai
// summary:
// Deprecated methods for setting/getting wai roles and states.
// New code should call setAttribute()/getAttribute() directly.
//
// Also loads hccss to apply dj_a11y class to root node if machine is in high-contrast mode.

lang.mixin(dijit, {
var exports = {
// summary:
// Deprecated methods for setting/getting wai roles and states.
// New code should call setAttribute()/getAttribute() directly.
//
// Also loads hccss to apply dj_a11y class to root node if machine is in high-contrast mode.

hasWaiRole: function(/*Element*/ elem, /*String?*/ role){
// summary:
// Determines if an element has a particular role.
Expand Down Expand Up @@ -99,7 +100,10 @@ define([

elem.removeAttribute("aria-"+state);
}
});
};

lang.mixin(dijit, exports);

return dijit;
/*===== return exports; =====*/
return dijit; // for back compat :-(
});
9 changes: 7 additions & 2 deletions _base/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ define([
], function(windowUtils, dijit){
// module:
// dijit/_base/window
// summary:
// Back compatibility module, new code should use windowUtils directly instead of using this module.

/*=====
return {
// summary:
// Back compatibility module, new code should use windowUtils directly instead of using this module.
};
=====*/

dijit.getDocumentWindow = function(doc){
return windowUtils.get(doc);
Expand Down

0 comments on commit 56ead81

Please sign in to comment.