diff --git a/_base/Color.js b/_base/Color.js index a12f24b4d8..6f416e5f75 100644 --- a/_base/Color.js +++ b/_base/Color.js @@ -3,19 +3,19 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array var Color = dojo.Color = function(/*Array|String|Object*/ color){ // summary: // Takes a named string, hex string, array of rgb or rgba values, - // an object with r, g, b, and a properties, or another `dojo.Color` object + // an object with r, g, b, and a properties, or another `Color` object // and creates a new Color instance to work from. // // example: // Work with a Color instance: - // | var c = new dojo.Color(); + // | var c = new Color(); // | c.setColor([0,0,0]); // black // | var hex = c.toHex(); // #000000 // // example: // Work with a node's color: // | var color = dojo.style("someNode", "backgroundColor"); - // | var n = new dojo.Color(color); + // | var n = new Color(color); // | // adjust the color some // | n.r *= .5; // | console.log(n.toString()); // rgb(128, 255, 255); @@ -55,11 +55,11 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array setColor: function(/*Array|String|Object*/ color){ // summary: // Takes a named string, hex string, array of rgb or rgba values, - // an object with r, g, b, and a properties, or another `dojo.Color` object + // an object with r, g, b, and a properties, or another `Color` object // and sets this color instance to that value. // // example: - // | var c = new dojo.Color(); // no color + // | var c = new Color(); // no color // | c.setColor("#ededed"); // greyish if(lang.isString(color)){ Color.fromString(color, this); @@ -69,7 +69,7 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array this._set(color.r, color.g, color.b, color.a); if(!(color instanceof Color)){ this.sanitize(); } } - return this; // dojo.Color + return this; // Color }, sanitize: function(){ // summary: @@ -77,13 +77,13 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array // description: // the default implementation does nothing, include dojo.colors to // augment it with real checks - return this; // dojo.Color + return this; // Color }, toRgb: function(){ // summary: // Returns 3 component array of rgb values // example: - // | var c = new dojo.Color("#000000"); + // | var c = new Color("#000000"); // | console.log(c.toRgb()); // [0,0,0] var t = this; return [t.r, t.g, t.b]; // Array @@ -99,7 +99,7 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array // summary: // Returns a CSS color string in hexadecimal representation // example: - // | console.log(new dojo.Color([0,0,0]).toHex()); // #000000 + // | console.log(new Color([0,0,0]).toHex()); // #000000 var arr = ArrayUtil.map(["r", "g", "b"], function(x){ var s = this[x].toString(16); return s.length < 2 ? "0" + s : s; @@ -110,7 +110,7 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array // summary: // Returns a css color string in rgb(a) representation // example: - // | var c = new dojo.Color("#FFF").toCss(); + // | var c = new Color("#FFF").toCss(); // | console.log(c); // rgb('255','255','255') var t = this, rgb = t.r + ", " + t.g + ", " + t.b; return (includeAlpha ? "rgba(" + rgb + ", " + t.a : "rgb(" + rgb) + ")"; // String @@ -123,42 +123,42 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array }); Color.blendColors = dojo.blendColors = function( - /*dojo.Color*/ start, - /*dojo.Color*/ end, + /*Color*/ start, + /*Color*/ end, /*Number*/ weight, - /*dojo.Color?*/ obj + /*Color?*/ obj ){ // summary: // Blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend, - // can reuse a previously allocated dojo.Color object for the result + // can reuse a previously allocated Color object for the result var t = obj || new Color(); ArrayUtil.forEach(["r", "g", "b", "a"], function(x){ t[x] = start[x] + (end[x] - start[x]) * weight; if(x != "a"){ t[x] = Math.round(t[x]); } }); - return t.sanitize(); // dojo.Color + return t.sanitize(); // Color }; - Color.fromRgb = dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){ + Color.fromRgb = dojo.colorFromRgb = function(/*String*/ color, /*Color?*/ obj){ // summary: - // Returns a `dojo.Color` instance from a string of the form - // "rgb(...)" or "rgba(...)". Optionally accepts a `dojo.Color` + // Returns a `Color` instance from a string of the form + // "rgb(...)" or "rgba(...)". Optionally accepts a `Color` // object to update with the parsed value and return instead of // creating a new object. // returns: - // A dojo.Color object. If obj is passed, it will be the return value. + // A Color object. If obj is passed, it will be the return value. var m = color.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/); - return m && Color.fromArray(m[1].split(/\s*,\s*/), obj); // dojo.Color + return m && Color.fromArray(m[1].split(/\s*,\s*/), obj); // Color }; - Color.fromHex = dojo.colorFromHex = function(/*String*/ color, /*dojo.Color?*/ obj){ + Color.fromHex = dojo.colorFromHex = function(/*String*/ color, /*Color?*/ obj){ // summary: // Converts a hex string with a '#' prefix to a color object. // Supports 12-bit #rgb shorthand. Optionally accepts a - // `dojo.Color` object to update with the parsed value. + // `Color` object to update with the parsed value. // // returns: - // A dojo.Color object. If obj is passed, it will be the return value. + // A Color object. If obj is passed, it will be the return value. // // example: // | var thing = dojo.colorFromHex("#ededed"); // grey, longhand @@ -170,7 +170,7 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array mask = (1 << bits) - 1; color = Number("0x" + color.substr(1)); if(isNaN(color)){ - return null; // dojo.Color + return null; // Color } ArrayUtil.forEach(["b", "g", "r"], function(x){ var c = color & mask; @@ -178,24 +178,24 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array t[x] = bits == 4 ? 17 * c : c; }); t.a = 1; - return t; // dojo.Color + return t; // Color }; - Color.fromArray = dojo.colorFromArray = function(/*Array*/ a, /*dojo.Color?*/ obj){ + Color.fromArray = dojo.colorFromArray = function(/*Array*/ a, /*Color?*/ obj){ // summary: - // Builds a `dojo.Color` from a 3 or 4 element array, mapping each + // Builds a `Color` from a 3 or 4 element array, mapping each // element in sequence to the rgb(a) values of the color. // example: // | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha // returns: - // A dojo.Color object. If obj is passed, it will be the return value. + // A Color object. If obj is passed, it will be the return value. var t = obj || new Color(); t._set(Number(a[0]), Number(a[1]), Number(a[2]), Number(a[3])); if(isNaN(t.a)){ t.a = 1; } - return t.sanitize(); // dojo.Color + return t.sanitize(); // Color }; - Color.fromString = dojo.colorFromString = function(/*String*/ str, /*dojo.Color?*/ obj){ + Color.fromString = dojo.colorFromString = function(/*String*/ str, /*Color?*/ obj){ // summary: // Parses `str` for a color value. Accepts hex, rgb, and rgba // style color values. @@ -205,9 +205,9 @@ define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, Array // rgb or rgba strings such as "rgb(133, 200, 16)" or "rgba(10, 10, // 10, 50)" // returns: - // A dojo.Color object. If obj is passed, it will be the return value. + // A Color object. If obj is passed, it will be the return value. var a = Color.named[str]; - return a && Color.fromArray(a, obj) || Color.fromRgb(str, obj) || Color.fromHex(str, obj); // dojo.Color + return a && Color.fromArray(a, obj) || Color.fromRgb(str, obj) || Color.fromHex(str, obj); // Color }; return Color; diff --git a/_base/NodeList.js b/_base/NodeList.js index 2964f0a79d..e9d570bc24 100644 --- a/_base/NodeList.js +++ b/_base/NodeList.js @@ -1,16 +1,26 @@ define(["./kernel", "../query", "./array", "./html", "../NodeList-dom"], function(dojo, query, array){ - // module: - // dojo/_base/NodeList - // summary: - // This module defines dojo.NodeList. + // module: + // dojo/_base/NodeList + // summary: + // This module extends dojo/query/NodeList with the legacy connect(), coords(), + // blur(), focus(), change(), click(), error(), keydown(), keypress(), + // keyup(), load(), mousedown(), mouseenter(), mouseleave(), mousemove(), + // mouseout(), mouseover(), mouseup(), and submit() methods. - var NodeList = query.NodeList; + var NodeList = query.NodeList, + nlp = NodeList.prototype; + nlp.connect = NodeList._adaptAsForEach(function(){ + // don't bind early to dojo.connect since we no longer explicitly depend on it + return dojo.connect.apply(this, arguments); + }); /*===== - NodeList.prototype.connect = function(methodName, objOrFunc, funcName){ + nlp.connect = function(methodName, objOrFunc, funcName){ // summary: - // attach event handlers to every item of the NodeList. Uses dojo.connect() - // so event properties are normalized + // Attach event handlers to every item of the NodeList. Uses dojo.connect() + // so event properties are normalized. + // + // Application must manually require() "dojo/_base/connect" before using this method. // methodName: String // the name of the method to attach to. For DOM events, this should be // the lower-case name of the event @@ -25,31 +35,30 @@ define(["./kernel", "../query", "./array", "./html", "../NodeList-dom"], functio // event. May also be a function reference. // example: // add an onclick handler to every button on the page - // | dojo.query("div:nth-child(odd)").connect("onclick", function(e){ + // | query("div:nth-child(odd)").connect("onclick", function(e){ // | console.log("clicked!"); // | }); // example: // attach foo.bar() to every odd div's onmouseover - // | dojo.query("div:nth-child(odd)").connect("onmouseover", foo, "bar"); + // | query("div:nth-child(odd)").connect("onmouseover", foo, "bar"); + + return null; // NodeList }; - NodeList.prototype.coords = function(){ + =====*/ + + nlp.coords = NodeList._adaptAsMap(dojo.coords); + /*===== + nlp.coords = function(){ // summary: // Deprecated: Use position() for border-box x/y/w/h // or marginBox() for margin-box w/h/l/t. // Returns the box objects of all elements in a node list as - // an Array (*not* a NodeList). Acts like `dojo.coords`, though assumes + // an Array (*not* a NodeList). Acts like `domGeom.coords`, though assumes // the node passed is each node in this list. - return dojo.map(this, dojo.coords); // Array + return []; // Array }; =====*/ - var nlp = NodeList.prototype; - - // don't bind early to dojo.connect since we no longer explicitly depend on it - nlp.connect = NodeList._adaptAsForEach(function(){ - return dojo.connect.apply(this, arguments); - }); - nlp.coords = NodeList._adaptAsMap(dojo.coords); NodeList.events = [ // summary: @@ -92,5 +101,5 @@ define(["./kernel", "../query", "./array", "./html", "../NodeList-dom"], functio ); dojo.NodeList = NodeList; - return dojo.NodeList; + return NodeList; }); diff --git a/_base/declare.js b/_base/declare.js index a0234203db..b2ff53f402 100644 --- a/_base/declare.js +++ b/_base/declare.js @@ -238,7 +238,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ function safeMixin(target, source){ // summary: // Mix in properties skipping a constructor and decorating functions - // like it is done by dojo.declare. + // like it is done by declare(). // target: Object // Target object to accept new properties. // source: Object @@ -246,17 +246,17 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // description: // This function is used to mix in properties like lang.mixin does, // but it skips a constructor property and decorates functions like - // dojo.declare does. + // declare() does. // // It is meant to be used with classes and objects produced with - // dojo.declare. Functions mixed in with dojo.safeMixin can use + // declare. Functions mixed in with dojo.safeMixin can use // this.inherited() like normal methods. // // This function is used to implement extend() method of a constructor - // produced with dojo.declare(). + // produced with declare(). // // example: - // | var A = dojo.declare(null, { + // | var A = declare(null, { // | m1: function(){ // | console.log("A.m1"); // | }, @@ -264,7 +264,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | console.log("A.m2"); // | } // | }); - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | m1: function(){ // | this.inherited(arguments); // | console.log("B.m1"); @@ -330,7 +330,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ return declare([this].concat(mixins)); } - // chained constructor compatible with the legacy dojo.declare() + // chained constructor compatible with the legacy declare() function chainedConstructor(bases, ctorSpecial){ return function(){ var a = arguments, args = a, a0 = a[0], f, i, m, @@ -342,7 +342,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ } //this._inherited = {}; - // perform the shaman's rituals of the original dojo.declare() + // perform the shaman's rituals of the original declare() // 1) call two types of the preamble if(ctorSpecial && (a0 && a0.preamble || this.preamble)){ // full blown ritual @@ -393,7 +393,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ } - // chained constructor compatible with the legacy dojo.declare() + // chained constructor compatible with the legacy declare() function singleConstructor(ctor, ctorSpecial){ return function(){ var a = arguments, t = a, a0 = a[0], f; @@ -404,7 +404,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ } //this._inherited = {}; - // perform the shaman's rituals of the original dojo.declare() + // perform the shaman's rituals of the original declare() // 1) call two types of the preamble if(ctorSpecial){ // full blown ritual @@ -449,7 +449,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ } //this._inherited = {}; - // perform the shaman's rituals of the original dojo.declare() + // perform the shaman's rituals of the original declare() // 1) do not call the preamble // 2) call the top constructor (it can use this.inherited()) for(; f = bases[i]; ++i){ // intentional assignment @@ -522,7 +522,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // The optional method name. Should be the same as the caller's // name. Usually "name" is specified in complex dynamic cases, when // the calling method was dynamically added, undecorated by - // dojo.declare, and it cannot be determined. + // declare(), and it cannot be determined. // args: Arguments // The caller supply this argument, which should be the original // "arguments". @@ -536,7 +536,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // if "true" was specified as newArgs. // description: // This method is used inside method of classes produced with - // dojo.declare to call a super method (next in the chain). It is + // declare() to call a super method (next in the chain). It is // used for manually controlled chaining. Consider using the regular // chaining, because it is faster. Use "this.inherited()" only in // complex cases. @@ -560,7 +560,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // method (using a methoid property "nom"). // // example: - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | method1: function(a, b, c){ // | this.inherited(arguments); // | }, @@ -575,7 +575,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | this.inherited("method3", arguments); // | }; // example: - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | method: function(a, b){ // | var super = this.inherited(arguments, true); // | // ... @@ -596,7 +596,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // The optional method name. Should be the same as the caller's // name. Usually "name" is specified in complex dynamic cases, when // the calling method was dynamically added, undecorated by - // dojo.declare, and it cannot be determined. + // declare(), and it cannot be determined. // args: Arguments // The caller supply this argument, which should be the original // "arguments". @@ -608,7 +608,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // method, it returns it, or "undefined" if not found. // // example: - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | method: function(a, b){ // | var super = this.getInherited(arguments); // | // ... @@ -633,23 +633,23 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // otherwise. // description: // This method is used with instances of classes produced with - // dojo.declare to determine of they support a certain interface or + // declare() to determine of they support a certain interface or // not. It models "instanceof" operator. // // example: - // | var A = dojo.declare(null, { + // | var A = declare(null, { // | // constructor, properties, and methods go here // | // ... // | }); - // | var B = dojo.declare(null, { + // | var B = declare(null, { // | // constructor, properties, and methods go here // | // ... // | }); - // | var C = dojo.declare([A, B], { + // | var C = declare([A, B], { // | // constructor, properties, and methods go here // | // ... // | }); - // | var D = dojo.declare(A, { + // | var D = declare(A, { // | // constructor, properties, and methods go here // | // ... // | }); @@ -683,7 +683,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // Adds all properties and methods of source to constructor's // prototype, making them available to all instances created with // constructor. This method is specific to constructors created with - // dojo.declare. + // declare(). // source: Object // Source object which properties are going to be copied to the // constructor's prototype. @@ -692,12 +692,12 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // override existing properties. // // This method is similar to dojo.extend function, but it is specific - // to constructors produced by dojo.declare. It is implemented + // to constructors produced by declare(). It is implemented // using dojo.safeMixin, and it skips a constructor property, // and properly decorates copied functions. // // example: - // | var A = dojo.declare(null, { + // | var A = declare(null, { // | m1: function(){}, // | s1: "Popokatepetl" // | }); @@ -738,7 +738,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // they have been mixed in. // // Ancestors can be compound classes created by this version of - // dojo.declare. In complex cases all base classes are going to be + // declare(). In complex cases all base classes are going to be // linearized according to C3 MRO algorithm // (see http://www.python.org/download/releases/2.3/mro/ for more // details). @@ -755,7 +755,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // cases. // // It is possible to use constructors created "manually" (without - // dojo.declare) as bases. They will be called as usual during the + // declare()) as bases. They will be called as usual during the // creation of an instance, their methods will be chained, and even // called by "this.inherited()". // @@ -796,7 +796,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // return any value: any returned value will be discarded. // // example: - // | dojo.declare("my.classes.bar", my.classes.foo, { + // | declare("my.classes.bar", my.classes.foo, { // | // properties to be added to the class prototype // | someValue: 2, // | // initialization function @@ -810,19 +810,19 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | }); // // example: - // | var MyBase = dojo.declare(null, { + // | var MyBase = declare(null, { // | // constructor, properties, and methods go here // | // ... // | }); - // | var MyClass1 = dojo.declare(MyBase, { + // | var MyClass1 = declare(MyBase, { // | // constructor, properties, and methods go here // | // ... // | }); - // | var MyClass2 = dojo.declare(MyBase, { + // | var MyClass2 = declare(MyBase, { // | // constructor, properties, and methods go here // | // ... // | }); - // | var MyDiamond = dojo.declare([MyClass1, MyClass2], { + // | var MyDiamond = declare([MyClass1, MyClass2], { // | // constructor, properties, and methods go here // | // ... // | }); @@ -832,7 +832,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | F.prototype.method = function(){ // | console.log("raw method"); // | }; - // | var A = dojo.declare(F, { + // | var A = declare(F, { // | constructor: function(){ // | console.log("A.constructor"); // | }, @@ -851,12 +851,12 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | // ...back in A // // example: - // | var A = dojo.declare(null, { + // | var A = declare(null, { // | "-chains-": { // | destroy: "before" // | } // | }); - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | constructor: function(){ // | console.log("B.constructor"); // | }, @@ -864,7 +864,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | console.log("B.destroy"); // | } // | }); - // | var C = dojo.declare(B, { + // | var C = declare(B, { // | constructor: function(){ // | console.log("C.constructor"); // | }, @@ -880,12 +880,12 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | // B.destroy // // example: - // | var A = dojo.declare(null, { + // | var A = declare(null, { // | "-chains-": { // | constructor: "manual" // | } // | }); - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | constructor: function(){ // | // ... // | // call the base constructor with new parameters @@ -895,7 +895,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | }); // // example: - // | var A = dojo.declare(null, { + // | var A = declare(null, { // | "-chains-": { // | m1: "before" // | }, @@ -906,7 +906,7 @@ define(["./kernel", "../has", "./lang"], function(dojo, has, lang){ // | console.log("A.m2"); // | } // | }); - // | var B = dojo.declare(A, { + // | var B = declare(A, { // | "-chains-": { // | m2: "after" // | }, diff --git a/_base/lang.js b/_base/lang.js index 4ac9ae9c5e..b5d7c05b47 100644 --- a/_base/lang.js +++ b/_base/lang.js @@ -119,7 +119,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // many class constructors often take an object which specifies // values to be configured on the object. In this case, it is // often simplest to call `lang.mixin` on the `this` object: - // | dojo.declare("acme.Base", null, { + // | declare("acme.Base", null, { // | constructor: function(properties){ // | // property configuration: // | lang.mixin(this, properties); @@ -273,7 +273,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ isArrayLike: function(it){ // summary: - // similar to dojo.isArray() but more permissive + // similar to isArray() but more permissive // it: anything // Item to test. // returns: @@ -282,8 +282,8 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // Doesn't strongly test for "arrayness". Instead, settles for "isn't // a string or number and has a length property". Arguments objects // and DOM collections will return true when passed to - // dojo.isArrayLike(), but will return false when passed to - // dojo.isArray(). + // isArrayLike(), but will return false when passed to + // isArray(). return it && it !== undefined && // Boolean // keep out built-in constructors (Number, String, ...) which have length // properties @@ -344,20 +344,20 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // A function to be hitched to scope, or the name of the method in // scope to be hitched. // example: - // | dojo.hitch(foo, "bar")(); + // | lang.hitch(foo, "bar")(); // runs foo.bar() in the scope of foo // example: - // | dojo.hitch(foo, myFunction); + // | lang.hitch(foo, myFunction); // returns a function that runs myFunction in the scope of foo // example: // Expansion on the default positional arguments passed along from // hitch. Passed args are mixed first, additional args after. // | var foo = { bar: function(a, b, c){ console.log(a, b, c); } }; - // | var fn = dojo.hitch(foo, "bar", 1, 2); + // | var fn = lang.hitch(foo, "bar", 1, 2); // | fn(3); // logs "1, 2, 3" // example: // | var foo = { bar: 2 }; - // | dojo.hitch(foo, function(){ this.bar = 10; })(); + // | lang.hitch(foo, function(){ this.bar = 10; })(); // execute an anonymous function in scope of foo if(arguments.length > 2){ return lang._hitchArgs.apply(dojo, arguments); // Function @@ -368,7 +368,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ } if(lang.isString(method)){ scope = scope || dojo.global; - if(!scope[method]){ throw(['dojo.hitch: scope["', method, '"] is null (scope="', scope, '")'].join('')); } + if(!scope[method]){ throw(['lang.hitch: scope["', method, '"] is null (scope="', scope, '")'].join('')); } return function(){ return scope[method].apply(scope, arguments || []); }; // Function } return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function @@ -409,7 +409,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // an Object of anonymous type // example: // | var foo = { bar: "baz" }; - // | var thinger = dojo.delegate(foo, { thud: "xyzzy"}); + // | var thinger = lang.delegate(foo, { thud: "xyzzy"}); // | thinger.bar == "baz"; // delegated to foo // | foo.thud == undefined; // by definition // | thinger.thud == "xyzzy"; // mixed in from props @@ -455,8 +455,8 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // similar to hitch() except that the scope object is left to be // whatever the execution context eventually becomes. // description: - // Calling dojo.partial is the functional equivalent of calling: - // | dojo.hitch(null, funcName, ...); + // Calling lang.partial is the functional equivalent of calling: + // | lang.hitch(null, funcName, ...); var arr = [ null ]; return lang.hitch.apply(dojo, arr.concat(lang._toArray(arguments))); // Function }, @@ -521,7 +521,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // (see [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript) // Uses String.prototype.trim instead, if available. // The fastest but longest version of this function is located at - // dojo.string.trim() + // lang.string.trim() }, =====*/ @@ -546,7 +546,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // Returns the substituted string. // example: // | // uses a dictionary for substitutions: - // | dojo.replace("Hello, {name.first} {name.last} AKA {nick}!", + // | lang.replace("Hello, {name.first} {name.last} AKA {nick}!", // | { // | nick: "Bob", // | name: { @@ -558,19 +558,19 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // | // returns: Hello, Robert Cringely AKA Bob! // example: // | // uses an array for substitutions: - // | dojo.replace("Hello, {0} {2}!", + // | lang.replace("Hello, {0} {2}!", // | ["Robert", "X", "Cringely"]); // | // returns: Hello, Robert Cringely! // example: // | // uses a function for substitutions: // | function sum(a){ // | var t = 0; - // | dojo.forEach(a, function(x){ t += x; }); + // | arrayforEach(a, function(x){ t += x; }); // | return t; // | } - // | dojo.replace( + // | lang.replace( // | "{count} payments averaging {avg} USD per payment.", - // | dojo.hitch( + // | lang.hitch( // | { payments: [11, 16, 12] }, // | function(_, key){ // | switch(key){ @@ -586,7 +586,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){ // | // prints: 3 payments averaging 13 USD per payment. // example: // | // uses an alternative PHP-like pattern for substitutions: - // | dojo.replace("Hello, ${0} ${2}!", + // | lang.replace("Hello, ${0} ${2}!", // | ["Robert", "X", "Cringely"], /\$\{([^\}]+)\}/g); // | // returns: Hello, Robert Cringely! diff --git a/_base/query.js b/_base/query.js index 05207109aa..eaba803fbb 100644 --- a/_base/query.js +++ b/_base/query.js @@ -1,3 +1,7 @@ -define(["./kernel", "../query", "./NodeList"], function(dojo){ - return dojo.query; +define(["../query", "./NodeList"], function(query){ + // module: + // dojo/_base/query + // summary: + // Deprecated. Use dojo/query instead. + return query; });