diff --git a/_base/Deferred.js b/_base/Deferred.js index d04a52d112..d27563acc0 100644 --- a/_base/Deferred.js +++ b/_base/Deferred.js @@ -51,7 +51,7 @@ define(["./kernel", "./lang"], function(dojo){ // Callbacks are allowed to return promises themselves, so // you can build complicated sequences of events with ease. // - // The creator of the Deferred may specify a canceller. The canceller + // The creator of the Deferred may specify a canceller. The canceller // is a function that will be called if Deferred.cancel is called // before the Deferred fires. You can use this to implement clean // aborting of an XMLHttpRequest, etc. Note that cancel will fire the diff --git a/_base/NodeList.js b/_base/NodeList.js index b6261c7544..580dae1946 100644 --- a/_base/NodeList.js +++ b/_base/NodeList.js @@ -44,13 +44,13 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // adapters var adaptAsForEach = function(f, o){ - // summary: + // summary: // adapts a single node function to be used in the forEach-type // actions. The initial object is returned from the specialized // function. - // f: Function + // f: Function // a function to adapt - // o: Object? + // o: Object? // an optional context for f return function(){ this.forEach(loopBody(f, arguments, o)); @@ -59,12 +59,12 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }; var adaptAsMap = function(f, o){ - // summary: + // summary: // adapts a single node function to be used in the map-type // actions. The return is a new array of values, as via `dojo.map` - // f: Function + // f: Function // a function to adapt - // o: Object? + // o: Object? // an optional context for f return function(){ return this.map(loopBody(f, arguments, o)); @@ -72,11 +72,11 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }; var adaptAsFilter = function(f, o){ - // summary: + // summary: // adapts a single node function to be used in the filter-type actions - // f: Function + // f: Function // a function to adapt - // o: Object? + // o: Object? // an optional context for f return function(){ return this.filter(loopBody(f, arguments, o)); @@ -84,14 +84,14 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }; var adaptWithCondition = function(f, g, o){ - // summary: + // summary: // adapts a single node function to be used in the map-type // actions, behaves like forEach() or map() depending on arguments - // f: Function + // f: Function // a function to adapt - // g: Function + // g: Function // a condition function, if true runs as map(), otherwise runs as forEach() - // o: Object? + // o: Object? // an optional context for f and g return function(){ var a = arguments, body = loopBody(f, a, o); @@ -104,13 +104,13 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }; var magicGuard = function(a){ - // summary: + // summary: // the guard function for dojo.attr() and dojo.style() return a.length == 1 && (typeof a[0] == "string"); // inline'd type check }; var orphan = function(node){ - // summary: + // summary: // function to orphan nodes var p = node.parentNode; if(p){ @@ -120,28 +120,28 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // FIXME: should we move orphan() to dojo.html? dojo.NodeList = function(){ - // summary: + // summary: // dojo.NodeList is an of Array subclass which adds syntactic // sugar for chaining, common iteration operations, animation, and // node manipulation. NodeLists are most often returned as the // result of dojo.query() calls. - // description: + // description: // dojo.NodeList instances provide many utilities that reflect // core Dojo APIs for Array iteration and manipulation, DOM // manipulation, and event handling. Instead of needing to dig up // functions in the dojo.* namespace, NodeLists generally make the // full power of Dojo available for DOM manipulation tasks in a // simple, chainable way. - // example: + // example: // create a node list from a node // | new dojo.NodeList(dojo.byId("foo")); - // example: + // example: // get a NodeList from a CSS query and iterate on it // | var l = dojo.query(".thinger"); // | l.forEach(function(node, index, nodeList){ // | console.log(index, node.innerHTML); // | }); - // example: + // example: // use native and Dojo-provided array methods to manipulate a // NodeList without needing to use dojo.* functions explicitly: // | var l = dojo.query(".thinger"); @@ -160,7 +160,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // | // function to get specific items wrapped in a new NodeList: // | var node = l[3]; // the 4th element // | var newList = l.at(1, 3); // the 2nd and 4th elements - // example: + // example: // the style functions you expect are all there too: // | // style() as a getter... // | var borders = dojo.query(".thinger").style("border"); @@ -170,7 +170,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // | dojo.query("li:nth-child(even)").addClass("even"); // | // even getting the coordinates of all the items // | var coords = dojo.query(".thinger").coords(); - // example: + // example: // DOM manipulation functions from the dojo.* namespace area also // available: // | // remove all of the elements in the list from their @@ -178,7 +178,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // | dojo.query(".thinger").orphan(); // | // place all elements in the list at the front of #foo // | dojo.query(".thinger").place("foo", "first"); - // example: + // example: // Event handling couldn't be easier. `dojo.connect` is mapped in, // and shortcut handlers are provided for most DOM events: // | // like dojo.connect(), but with implicit scope @@ -190,7 +190,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // | dojo.query("p") // | .onmouseenter(toggleHovered) // | .onmouseleave(toggleHovered); - // example: + // example: // chainability is a key advantage of NodeLists: // | dojo.query(".thinger") // | .onclick(function(e){ /* ... */ }) @@ -211,7 +211,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ nl._wrap = nlp._wrap = tnl; nl._adaptAsMap = adaptAsMap; nl._adaptAsForEach = adaptAsForEach; - nl._adaptAsFilter = adaptAsFilter; + nl._adaptAsFilter = adaptAsFilter; nl._adaptWithCondition = adaptWithCondition; // mass assignment @@ -258,7 +258,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // (if dojo.parser has been dojo.required elsewhere). //Wanted to just use a DocumentFragment, but for the array/NodeList - //case that meant using cloneNode, but we may not want that. + //case that meant using cloneNode, but we may not want that. //Cloning should only happen if the node operations span //multiple refNodes. Also, need a real array, not a NodeList from the //DOM since the node movements could change those NodeLists. @@ -458,18 +458,18 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, indexOf: function(value, fromIndex){ - // summary: + // summary: // see dojo.indexOf(). The primary difference is that the acted-on // array is implicitly this NodeList // value: Object: // The value to search for. // fromIndex: Integer?: // The location to start searching from. Optional. Defaults to 0. - // description: + // description: // For more details on the behavior of indexOf, see Mozilla's // (indexOf // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf] - // returns: + // returns: // Positive Integer or 0 for a match, -1 of not found. return d.indexOf(this, value, fromIndex); // Integer }, @@ -478,7 +478,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // summary: // see dojo.lastIndexOf(). The primary difference is that the // acted-on array is implicitly this NodeList - // description: + // description: // For more details on the behavior of lastIndexOf, see // Mozilla's (lastIndexOf // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf] @@ -492,7 +492,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, every: function(callback, thisObject){ - // summary: + // summary: // see `dojo.every()` and the (Array.every // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:every]. // Takes the same structure of arguments and returns as @@ -504,10 +504,10 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, some: function(callback, thisObject){ - // summary: + // summary: // Takes the same structure of arguments and returns as // `dojo.some()` with the caveat that the passed array is - // implicitly this NodeList. See `dojo.some()` and Mozilla's + // implicitly this NodeList. See `dojo.some()` and Mozilla's // (Array.some // documentation)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:some]. // callback: Function: the callback @@ -553,7 +553,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, map: function(/*Function*/ func, /*Function?*/ obj){ - // summary: + // summary: // see dojo.map(). The primary difference is that the acted-on // array is implicitly this NodeList and the return is a // dojo.NodeList (a subclass of Array) @@ -562,7 +562,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, forEach: function(callback, thisObj){ - // summary: + // summary: // see `dojo.forEach()`. The primary difference is that the acted-on // array is implicitly this NodeList. If you want the option to break out // of the forEach loop, use every() or some() instead. @@ -573,7 +573,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ /*===== coords: function(){ - // summary: + // summary: // Returns the box objects of all elements in a node list as // an Array (*not* a NodeList). Acts like `dojo.coords`, though assumes // the node passed is each node in this list. @@ -582,7 +582,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, position: function(){ - // summary: + // summary: // Returns border-box objects (x/y/w/h) of all elements in a node list // as an Array (*not* a NodeList). Acts like `dojo.position`, though // assumes the node passed is each node in this list. @@ -591,23 +591,23 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, attr: function(property, value){ - // summary: + // summary: // gets or sets the DOM attribute for every element in the // NodeList. See also `dojo.attr` - // property: String + // property: String // the attribute to get/set - // value: String? + // value: String? // optional. The value to set the property to - // returns: + // returns: // if no value is passed, the result is an array of attribute values // If a value is passed, the return is this NodeList - // example: + // example: // Make all nodes with a particular class focusable: // | dojo.query(".focusable").attr("tabIndex", -1); - // example: + // example: // Disable a group of buttons: // | dojo.query("button.group").attr("disabled", true); - // example: + // example: // innerHTML can be assigned or retrieved as well: // | // get the innerHTML (as an array) for each list item // | var ih = dojo.query("li.replaceable").attr("innerHTML"); @@ -616,14 +616,14 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, style: function(property, value){ - // summary: + // summary: // gets or sets the CSS property for every element in the NodeList - // property: String + // property: String // the CSS property to get/set, in JavaScript notation // ("lineHieght" instead of "line-height") - // value: String? + // value: String? // optional. The value to set the property to - // returns: + // returns: // if no value is passed, the result is an array of strings. // If a value is passed, the return is this NodeList return; // dojo.NodeList @@ -631,54 +631,54 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, addClass: function(className){ - // summary: + // summary: // adds the specified class to every node in the list - // className: String|Array + // className: String|Array // A String class name to add, or several space-separated class names, // or an array of class names. return; // dojo.NodeList }, removeClass: function(className){ - // summary: + // summary: // removes the specified class from every node in the list - // className: String|Array? + // className: String|Array? // An optional String class name to remove, or several space-separated // class names, or an array of class names. If omitted, all class names // will be deleted. - // returns: + // returns: // dojo.NodeList, this list return; // dojo.NodeList }, toggleClass: function(className, condition){ - // summary: + // summary: // Adds a class to node if not present, or removes if present. // Pass a boolean condition if you want to explicitly add or remove. - // condition: Boolean? + // condition: Boolean? // If passed, true means to add the class, false means to remove. - // className: String + // className: String // the CSS class to add return; // dojo.NodeList }, connect: function(methodName, objOrFunc, funcName){ - // summary: + // summary: // attach event handlers to every item of the NodeList. Uses dojo.connect() // so event properties are normalized - // methodName: String + // methodName: String // the name of the method to attach to. For DOM events, this should be // the lower-case name of the event - // objOrFunc: Object|Function|String + // objOrFunc: Object|Function|String // if 2 arguments are passed (methodName, objOrFunc), objOrFunc should // reference a function or be the name of the function in the global // namespace to attach. If 3 arguments are provided // (methodName, objOrFunc, funcName), objOrFunc must be the scope to // locate the bound function in - // funcName: String? + // funcName: String? // optional. A string naming the function in objOrFunc to bind to the // event. May also be a function reference. - // example: + // example: // add an onclick handler to every button on the page // | dojo.query("div:nth-child(odd)").connect("onclick", function(e){ // | console.log("clicked!"); @@ -689,7 +689,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, empty: function(){ - // summary: + // summary: // clears all content from each node in the list. Effectively // equivalent to removing all child nodes from every item in // the list. @@ -706,22 +706,22 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ /* destroy: function(){ - // summary: - // destroys every item in the list. + // summary: + // destroys every item in the list. this.forEach(d.destroy); // FIXME: should we be checking for and/or disposing of widgets below these nodes? }, */ place: function(/*String||Node*/ queryOrNode, /*String*/ position){ - // summary: + // summary: // places elements of this node list relative to the first element matched // by queryOrNode. Returns the original NodeList. See: `dojo.place` - // queryOrNode: + // queryOrNode: // may be a string representing any valid CSS3 selector or a DOM node. // In the selector case, only the first matching element will be used // for relative positioning. - // position: + // position: // can be one of: // | "last" (default) // | "first" @@ -735,26 +735,26 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, orphan: function(/*String?*/ filter){ - // summary: + // summary: // removes elements in this list that match the filter // from their parents and returns them as a new NodeList. - // filter: + // filter: // CSS selector like ".foo" or "div > span" - // returns: + // returns: // `dojo.NodeList` containing the orphaned elements return (filter ? d._filterQueryResult(this, filter) : this).forEach(orphan); // dojo.NodeList }, adopt: function(/*String||Array||DomNode*/ queryOrListOrNode, /*String?*/ position){ - // summary: + // summary: // places any/all elements in queryOrListOrNode at a // position relative to the first element in this list. // Returns a dojo.NodeList of the adopted elements. - // queryOrListOrNode: + // queryOrListOrNode: // a DOM node or a query string or a query result. // Represents the nodes to be adopted relative to the // first element of this NodeList. - // position: + // position: // can be one of: // | "last" (default) // | "first" @@ -768,11 +768,11 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // FIXME: do we need this? query: function(/*String*/ queryStr){ - // summary: + // summary: // Returns a new list whose members match the passed query, // assuming elements of the current NodeList as the root for // each search. - // example: + // example: // assume a DOM created by this markup: // |
// |

@@ -786,7 +786,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // | var l = new dojo.NodeList(dojo.byId("foo"), dojo.byId("bar")); // it's possible to find all span elements under paragraphs // contained by these elements with this sub-query: - // | var spans = l.query("p span"); + // | var spans = l.query("p span"); // FIXME: probably slow if(!queryStr){ return this; } @@ -798,14 +798,14 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, filter: function(/*String|Function*/ filter){ - // summary: + // summary: // "masks" the built-in javascript filter() method (supported // in Dojo via `dojo.filter`) to support passing a simple // string filter in addition to supporting filtering function // objects. - // filter: + // filter: // If a string, a CSS rule like ".thinger" or "div > span". - // example: + // example: // "regular" JS filter syntax as exposed in dojo.filter: // | dojo.query("*").filter(function(item){ // | // highlight every paragraph @@ -838,15 +838,15 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ */ addContent: function(/*String||DomNode||Object||dojo.NodeList*/ content, /*String||Integer?*/ position){ - // summary: + // summary: // add a node, NodeList or some HTML as a string to every item in the - // list. Returns the original list. - // description: + // list. Returns the original list. + // description: // a copy of the HTML content is added to each item in the // list, with an optional position argument. If no position // argument is provided, the content is appended to the end of // each item. - // content: + // content: // DOM node, HTML in string format, a NodeList or an Object. If a DOM node or // NodeList, the content will be cloned if the current NodeList has more than one // element. Only the DOM nodes are cloned, no event handlers. If it is an Object, @@ -857,7 +857,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // string should be parsed for widgets (dojo.require("dojo.parser") to get that // option to work), and "templateFunc" if a template function besides dojo.string.substitute // should be used to transform the "template". - // position: + // position: // can be one of: // | "last"||"end" (default) // | "first||"start" @@ -866,21 +866,21 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // | "replace" (replaces nodes in this NodeList with new content) // | "only" (removes other children of the nodes so new content is the only child) // or an offset in the childNodes property - // example: + // example: // appends content to the end if the position is omitted // | dojo.query("h3 > p").addContent("hey there!"); - // example: + // example: // add something to the front of each element that has a // "thinger" property: // | dojo.query("[thinger]").addContent("...", "first"); - // example: + // example: // adds a header before each element of the list // | dojo.query(".note").addContent("

NOTE:

", "before"); - // example: + // example: // add a clone of a DOM node to the end of every element in // the list, removing it from its existing parent. // | dojo.query(".note").addContent(dojo.byId("foo")); - // example: + // example: // Append nodes from a templatized string. // dojo.require("dojo.string"); // dojo.query(".note").addContent({ @@ -888,7 +888,7 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ // id: "user332", // name: "Mr. Anderson" // }); - // example: + // example: // Append nodes from a templatized string that also has widgets parsed. // dojo.require("dojo.string"); // dojo.require("dojo.parser"); @@ -905,11 +905,11 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, instantiate: function(/*String|Object*/ declaredClass, /*Object?*/ properties){ - // summary: + // summary: // Create a new instance of a specified class, using the // specified properties and each node in the nodeList as a // srcNodeRef. - // example: + // example: // Grabs all buttons in the page and converts them to diji.form.Buttons. // | var buttons = dojo.query("button").instantiate("dijit.form.Button", {showLabel: true}); var c = d.isFunction(declaredClass) ? declaredClass : d.getObject(declaredClass); @@ -920,31 +920,31 @@ define(["./kernel", "./lang", "./array", "./connect", "./html"], function(dojo){ }, at: function(/*===== index =====*/){ - // summary: + // summary: // Returns a new NodeList comprised of items in this NodeList // at the given index or indices. // - // index: Integer... + // index: Integer... // One or more 0-based indices of items in the current // NodeList. A negative index will start at the end of the // list and go backwards. // - // example: + // example: // Shorten the list to the first, second, and third elements // | dojo.query("a").at(0, 1, 2).forEach(fn); // - // example: + // example: // Retrieve the first and last elements of a unordered list: // | dojo.query("ul > li").at(0, -1).forEach(cb); // - // example: + // example: // Do something for the first element only, but end() out back to // the original list and continue chaining: // | dojo.query("a").at(0).onclick(fn).end().forEach(function(n){ // | console.log(n); // all anchors on the page. // | }) // - // returns: + // returns: // dojo.NodeList var t = new this._NodeListCtor(); d.forEach(arguments, function(i){ diff --git a/_base/connect.js b/_base/connect.js index 573e9ddf7d..cd050ecbb7 100644 --- a/_base/connect.js +++ b/_base/connect.js @@ -271,7 +271,7 @@ dojo.publish = function(/*String*/ topic, /*Array*/ args){ // | dojo.publish("alerts", [ "read this", "hello world" ]); // Note that args is an array, which is more efficient vs variable length - // argument list. Ideally, var args would be implemented via Array + // argument list. Ideally, var args would be implemented via Array // throughout the APIs. var f = dojo._topics[topic]; if(f){ diff --git a/_base/declare.js b/_base/declare.js index be12422801..8485240ed3 100644 --- a/_base/declare.js +++ b/_base/declare.js @@ -218,14 +218,14 @@ define(["./kernel", "../has", "./lang", "./array"], function(dojo, has){ target[name] = source[name]; } } - if (has("bug-for-in-skips-shadowed")){ - for(var extraNames= d._extraNames, i= extraNames.length; i;){ - name = extraNames[--i]; - if(name != cname && source.hasOwnProperty(name)){ - target[name] = source[name]; - } - } - } + if(has("bug-for-in-skips-shadowed")){ + for(var extraNames= d._extraNames, i= extraNames.length; i;){ + name = extraNames[--i]; + if(name != cname && source.hasOwnProperty(name)){ + target[name] = source[name]; + } + } + } } // implementation of safe mixin function @@ -242,19 +242,19 @@ define(["./kernel", "../has", "./lang", "./array"], function(dojo, has){ target[name] = t; } } - if (has("bug-for-in-skips-shadowed")){ - for(var extraNames= d._extraNames, i= extraNames.length; i;){ - name = extraNames[--i]; - t = source[name]; - if((t !== op[name] || !(name in op)) && name != cname){ - if(opts.call(t) == "[object Function]"){ - // non-trivial function method => attach its name - t.nom = name; - } - target[name] = t; - } - } - } + if(has("bug-for-in-skips-shadowed")){ + for(var extraNames= d._extraNames, i= extraNames.length; i;){ + name = extraNames[--i]; + t = source[name]; + if((t !== op[name] || !(name in op)) && name != cname){ + if(opts.call(t) == "[object Function]"){ + // non-trivial function method => attach its name + t.nom = name; + } + target[name] = t; + } + } + } return target; } @@ -1036,5 +1036,5 @@ define(["./kernel", "../has", "./lang", "./array"], function(dojo, has){ }; =====*/ - return dojo.declare; + return dojo.declare; }); diff --git a/_base/event.js b/_base/event.js index f398ded445..001f902d4d 100644 --- a/_base/event.js +++ b/_base/event.js @@ -288,14 +288,14 @@ define(["./kernel", "./connect", "./sniff"], function(dojo){ }else{ //>>excludeEnd("webkitMobile"); dojo.mouseButtons = { - LEFT: 0, + LEFT: 0, MIDDLE: 1, - RIGHT: 2, + RIGHT: 2, // helper functions isButton: function(e, button){ return e.button == button; }, - isLeft: function(e){ return e.button == 0; }, + isLeft: function(e){ return e.button == 0; }, isMiddle: function(e){ return e.button == 1; }, - isRight: function(e){ return e.button == 2; } + isRight: function(e){ return e.button == 2; } }; //>>excludeStart("webkitMobile", kwArgs.webkitMobile); } @@ -480,7 +480,7 @@ define(["./kernel", "./connect", "./sniff"], function(dojo){ var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c}); kp.call(evt.currentTarget, faux); if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){ - evt.cancelBubble = faux.cancelBubble; + evt.cancelBubble = faux.cancelBubble; } evt.returnValue = faux.returnValue; _trySetKeyCode(evt, faux.keyCode); @@ -617,41 +617,41 @@ define(["./kernel", "./connect", "./sniff"], function(dojo){ } //>>excludeEnd("webkitMobile"); -//>>excludeStart("webkitMobile", kwArgs.webkitMobile); -if(dojo.isIE){ - // keep this out of the closure - // closing over 'iel' or 'ieh' b0rks leak prevention - // ls[i] is an index into the master handler array - dojo._ieDispatcher = function(args, sender){ - var ap = Array.prototype, - h = dojo._ie_listener.handlers, - c = args.callee, - ls = c[dojo._ieListenersName], - t = h[c.target]; - // return value comes from original target function - var r = t && t.apply(sender, args); - // make local copy of listener array so it's immutable during processing - var lls = [].concat(ls); - // invoke listeners after target function - for(var i in lls){ - var f = h[lls[i]]; - if(!(i in ap) && f){ - f.apply(sender, args); + //>>excludeStart("webkitMobile", kwArgs.webkitMobile); + if(dojo.isIE){ + // keep this out of the closure + // closing over 'iel' or 'ieh' b0rks leak prevention + // ls[i] is an index into the master handler array + dojo._ieDispatcher = function(args, sender){ + var ap = Array.prototype, + h = dojo._ie_listener.handlers, + c = args.callee, + ls = c[dojo._ieListenersName], + t = h[c.target]; + // return value comes from original target function + var r = t && t.apply(sender, args); + // make local copy of listener array so it's immutable during processing + var lls = [].concat(ls); + // invoke listeners after target function + for(var i in lls){ + var f = h[lls[i]]; + if(!(i in ap) && f){ + f.apply(sender, args); + } } - } - return r; - }; - dojo._getIeDispatcher = function(){ - // ensure the returned function closes over nothing ("new Function" apparently doesn't close) - return new Function(dojo._scopeName + "._ieDispatcher(arguments, this)"); // function - }; - // keep this out of the closure to reduce RAM allocation - dojo._event_listener._fixCallback = function(fp){ - var f = dojo._event_listener._fixEvent; - return function(e){ return fp.call(this, f(e, this)); }; - }; -} -//>>excludeEnd("webkitMobile"); + return r; + }; + dojo._getIeDispatcher = function(){ + // ensure the returned function closes over nothing ("new Function" apparently doesn't close) + return new Function(dojo._scopeName + "._ieDispatcher(arguments, this)"); // function + }; + // keep this out of the closure to reduce RAM allocation + dojo._event_listener._fixCallback = function(fp){ + var f = dojo._event_listener._fixEvent; + return function(e){ return fp.call(this, f(e, this)); }; + }; + } + //>>excludeEnd("webkitMobile"); -return dojo.connect; + return dojo.connect; }); diff --git a/_base/fx.js b/_base/fx.js index 94a3b89e19..7445db9243 100644 --- a/_base/fx.js +++ b/_base/fx.js @@ -126,10 +126,10 @@ define(["./kernel", "./Color", "./connect", "./lang", "./html", "./sniff"], func }, _fire: function(/*Event*/ evt, /*Array?*/ args){ // summary: - // Convenience function. Fire event "evt" and pass it the + // Convenience function. Fire event "evt" and pass it the // arguments specified in "args". // description: - // Convenience function. Fire event "evt" and pass it the + // Convenience function. Fire event "evt" and pass it the // arguments specified in "args". // Fires the callback in the scope of the `dojo.Animation` // instance. @@ -409,7 +409,7 @@ define(["./kernel", "./Color", "./connect", "./lang", "./html", "./sniff"], func return d._fade(_mixin({ end: 1 }, args)); // dojo.Animation }; - dojo.fadeOut = function(/*dojo.__FadeArgs*/ args){ + dojo.fadeOut = function(/*dojo.__FadeArgs*/ args){ // summary: // Returns an animation that will fade node defined in 'args' // from its current opacity to fully transparent. @@ -615,7 +615,7 @@ define(["./kernel", "./Color", "./connect", "./lang", "./html", "./sniff"], func // immediately, unlike nearly every other Dojo animation API. // description: // `dojo.anim` is a simpler (but somewhat less powerful) version - // of `dojo.animateProperty`. It uses defaults for many basic properties + // of `dojo.animateProperty`. It uses defaults for many basic properties // and allows for positional parameters to be used in place of the // packed "property bag" which is used for other Dojo animation // methods. diff --git a/_base/html.js b/_base/html.js index 9915000fc3..1796c17f03 100644 --- a/_base/html.js +++ b/_base/html.js @@ -20,29 +20,29 @@ try{ /*===== dojo.byId = function(id, doc){ - // summary: + // summary: // Returns DOM node with matching `id` attribute or `null` // if not found. If `id` is a DomNode, this function is a no-op. // - // id: String|DOMNode + // id: String|DOMNode // A string to match an HTML id attribute or a reference to a DOM Node // - // doc: Document? + // doc: Document? // Document to work in. Defaults to the current value of - // dojo.doc. Can be used to retrieve + // dojo.doc. Can be used to retrieve // node references from other documents. // - // example: - // Look up a node by ID: + // example: + // Look up a node by ID: // | var n = dojo.byId("foo"); // - // example: - // Check if a node exists, and use it. + // example: + // Check if a node exists, and use it. // | var n = dojo.byId("bar"); // | if(n){ doStuff() ... } // - // example: - // Allow string or DomNode references to be passed to a custom function: + // example: + // Allow string or DomNode references to be passed to a custom function: // | var foo = function(nodeOrId){ // | nodeOrId = dojo.byId(nodeOrId); // | // ... more stuff @@ -111,23 +111,23 @@ if(dojo.isIE){ } =====*/ dojo._destroyElement = dojo.destroy = function(/*String|DomNode*/node){ - // summary: + // summary: // Removes a node from its parent, clobbering it and all of its // children. // - // description: + // description: // Removes a node from its parent, clobbering it and all of its // children. Function only works with DomNodes, and returns nothing. // - // node: + // node: // A String ID or DomNode reference of the element to be destroyed // - // example: - // Destroy a node byId: + // example: + // Destroy a node byId: // | dojo.destroy("someId"); // - // example: - // Destroy all nodes in a list by reference: + // example: + // Destroy all nodes in a list by reference: // | dojo.query(".someNode").forEach(dojo.destroy); node = byId(node); @@ -147,7 +147,7 @@ if(dojo.isIE){ }; dojo.isDescendant = function(/*DomNode|String*/node, /*DomNode|String*/ancestor){ - // summary: + // summary: // Returns true if node is a descendant of ancestor // node: // string id or node reference to test @@ -155,7 +155,7 @@ if(dojo.isIE){ // string id or node reference of potential parent to test against // // example: - // Test is node id="bar" is a descendant of node id="foo" + // Test is node id="bar" is a descendant of node id="foo" // | if(dojo.isDescendant("bar", "foo")){ ... } try{ node = byId(node); @@ -171,18 +171,18 @@ if(dojo.isIE){ }; dojo.setSelectable = function(/*DomNode|String*/node, /*Boolean*/selectable){ - // summary: + // summary: // Enable or disable selection on a node - // node: + // node: // id or reference to node - // selectable: + // selectable: // state to put the node in. false indicates unselectable, true // allows selection. - // example: - // Make the node id="bar" unselectable + // example: + // Make the node id="bar" unselectable // | dojo.setSelectable("bar"); - // example: - // Make the node id="bar" selectable + // example: + // Make the node id="bar" selectable // | dojo.setSelectable("bar", true); node = byId(node); //>>excludeStart("webkitMobile", kwArgs.webkitMobile); @@ -197,7 +197,7 @@ if(dojo.isIE){ d.query("*", node).forEach("item.unselectable = '"+v+"'"); } //>>excludeEnd("webkitMobile"); - //FIXME: else? Opera? + //FIXME: else? Opera? }; var _insertBefore = function(/*DomNode*/node, /*DomNode*/ref){ @@ -208,7 +208,7 @@ if(dojo.isIE){ }; var _insertAfter = function(/*DomNode*/node, /*DomNode*/ref){ - // summary: + // summary: // Try to insert node after ref var parent = ref.parentNode; if(parent){ @@ -221,17 +221,17 @@ if(dojo.isIE){ }; dojo.place = function(node, refNode, position){ - // summary: + // summary: // Attempt to insert node into the DOM, choosing from various positioning options. // Returns the first argument resolved to a DOM node. // - // node: String|DomNode + // node: String|DomNode // id or node reference, or HTML fragment starting with "<" to place relative to refNode // - // refNode: String|DomNode + // refNode: String|DomNode // id or node reference to use as basis for placement // - // position: String|Number? + // position: String|Number? // string noting the position of node relative to refNode or a // number indicating the location in the childNodes collection of refNode. // Accepted string values are: @@ -242,9 +242,9 @@ if(dojo.isIE){ // | * first // | * last // "first" and "last" indicate positions as children of refNode, "replace" replaces refNode, - // "only" replaces all children. position defaults to "last" if not specified + // "only" replaces all children. position defaults to "last" if not specified // - // returns: DomNode + // returns: DomNode // Returned values is the first argument resolved to a DOM node. // // .place() is also a method of `dojo.NodeList`, allowing `dojo.query` node lookups. @@ -344,10 +344,10 @@ if(dojo.isIE){ /*===== dojo.getComputedStyle = function(node){ - // summary: + // summary: // Returns a "computed style" object. // - // description: + // description: // Gets a "computed style" object which can be used to gather // information about the current state of the rendered node. // @@ -355,20 +355,20 @@ if(dojo.isIE){ // Values may have different formats and value encodings across // browsers. // - // Note also that this method is expensive. Wherever possible, + // Note also that this method is expensive. Wherever possible, // reuse the returned object. // // Use the dojo.style() method for more consistent (pixelized) // return values. // - // node: DOMNode + // node: DOMNode // A reference to a DOM node. Does NOT support taking an // ID string for speed reasons. - // example: + // example: // | dojo.getComputedStyle(dojo.byId('foo')).borderWidth; // - // example: - // Reusing the returned object, avoiding multiple lookups: + // example: + // Reusing the returned object, avoiding multiple lookups: // | var cs = dojo.getComputedStyle(dojo.byId("someNode")); // | var w = cs.width, h = cs.height; return; // CSS2Properties @@ -454,10 +454,10 @@ if(dojo.isIE){ // FIXME: there opacity quirks on FF that we haven't ported over. Hrm. /*===== dojo._getOpacity = function(node){ - // summary: + // summary: // Returns the current opacity of the passed node as a // floating-point value between 0 and 1. - // node: DomNode + // node: DomNode // a reference to a DOM node. Does NOT support taking an // ID string for speed reasons. // returns: @@ -493,13 +493,13 @@ if(dojo.isIE){ /*===== dojo._setOpacity = function(node, opacity){ - // summary: + // summary: // set the opacity of the passed node portably. Returns the // new opacity of the node. - // node: DOMNode + // node: DOMNode // a reference to a DOM node. Does NOT support taking an // ID string for performance reasons. - // opacity: Number + // opacity: Number // A Number between 0 and 1. 0 specifies transparent. // returns: // Number between 0 and 1 @@ -574,11 +574,11 @@ if(dojo.isIE){ dojo.style = function( /*DomNode|String*/ node, /*String?|Object?*/ style, /*String?*/ value){ - // summary: + // summary: // Accesses styles on a node. If 2 arguments are // passed, acts as a getter. If 3 arguments are passed, acts // as a setter. - // description: + // description: // Getting the style value uses the computed style for the node, so the value // will be a calculated value, not just the immediate node.style value. // Also when getting values, use specific style names, @@ -586,32 +586,32 @@ if(dojo.isIE){ // "border" are not necessarily reflected as expected. // If you want to get node dimensions, use `dojo.marginBox()`, // `dojo.contentBox()` or `dojo.position()`. - // node: + // node: // id or reference to node to get/set style for - // style: + // style: // the style property to set in DOM-accessor format // ("borderWidth", not "border-width") or an object with key/value // pairs suitable for setting each property. - // value: + // value: // If passed, sets value on the node for style, handling - // cross-browser concerns. When setting a pixel value, + // cross-browser concerns. When setting a pixel value, // be sure to include "px" in the value. For instance, top: "200px". // Otherwise, in some cases, some browsers will not apply the style. - // example: + // example: // Passing only an ID or node returns the computed style object of // the node: // | dojo.style("thinger"); - // example: + // example: // Passing a node and a style property returns the current // normalized, computed value for that property: // | dojo.style("thinger", "opacity"); // 1 by default // - // example: + // example: // Passing a node, a style property, and a value changes the // current display of the node and returns the new computed value // | dojo.style("thinger", "opacity", 0.5); // == 0.5 // - // example: + // example: // Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node: // | dojo.style("thinger", { // | "opacity": 0.5, @@ -619,7 +619,7 @@ if(dojo.isIE){ // | "height": "300px" // | }); // - // example: + // example: // When the CSS style property is hyphenated, the JavaScript property is camelCased. // font-size becomes fontSize, and so on. // | dojo.style("thinger",{ @@ -627,7 +627,7 @@ if(dojo.isIE){ // | letterSpacing:"1.2em" // | }); // - // example: + // example: // dojo.NodeList implements .style() using the same syntax, omitting the "node" parameter, calling // dojo.style() on every element of the list. See: `dojo.query()` and `dojo.NodeList()` // | dojo.query(".someClassName").style("visibility","hidden"); @@ -660,10 +660,10 @@ if(dojo.isIE){ // ============================= dojo._getPadExtents = function(/*DomNode*/n, /*Object*/computedStyle){ - // summary: + // summary: // Returns object with special values specifically useful for node // fitting. - // description: + // description: // Returns an object with `w`, `h`, `l`, `t` properties: // | l/t = left/top padding (respectively) // | w = the total of the left and right padding @@ -685,10 +685,10 @@ if(dojo.isIE){ }; dojo._getBorderExtents = function(/*DomNode*/n, /*Object*/computedStyle){ - // summary: + // summary: // returns an object with properties useful for noting the border // dimensions. - // description: + // description: // * l/t = the sum of left/top border (respectively) // * w = the sum of the left and right border // * h = the sum of the top and bottom border @@ -710,7 +710,7 @@ if(dojo.isIE){ }; dojo._getPadBorderExtents = function(/*DomNode*/n, /*Object*/computedStyle){ - // summary: + // summary: // Returns object with properties useful for box fitting with // regards to padding. // description: @@ -734,7 +734,7 @@ if(dojo.isIE){ }; dojo._getMarginExtents = function(n, computedStyle){ - // summary: + // summary: // returns object with properties useful for box fitting with // regards to box margins (i.e., the outer-box). // @@ -829,8 +829,8 @@ if(dojo.isIE){ dojo._getMarginSize = function(/*DomNode*/node, /*Object*/computedStyle){ // summary: - // returns an object that encodes the width and height of - // the node's margin box + // returns an object that encodes the width and height of + // the node's margin box node = byId(node); var me = d._getMarginExtents(node, computedStyle || gcs(node)); @@ -903,21 +903,21 @@ if(dojo.isIE){ // at all in computedStyle on Mozilla. dojo._setBox = function(/*DomNode*/node, /*Number?*/l, /*Number?*/t, /*Number?*/w, /*Number?*/h, /*String?*/u){ - // summary: + // summary: // sets width/height/left/top in the current (native) box-model // dimentions. Uses the unit passed in u. - // node: + // node: // DOM Node reference. Id string not supported for performance // reasons. - // l: + // l: // left offset from parent. - // t: + // t: // top offset from parent. - // w: + // w: // width in current box model. - // h: + // h: // width in current box model. - // u: + // u: // unit measure to use for other measures. Defaults to "px". u = u || "px"; var s = node.style; @@ -935,7 +935,7 @@ if(dojo.isIE){ }; dojo._usesBorderBox = function(/*DomNode*/node){ - // summary: + // summary: // True if the node uses border-box layout. // We could test the computed style of node to see if a particular box @@ -950,7 +950,7 @@ if(dojo.isIE){ }; dojo._setContentSize = function(/*DomNode*/node, /*Number*/widthPx, /*Number*/heightPx, /*Object*/computedStyle){ - // summary: + // summary: // Sets the size of the node's contents, irrespective of margins, // padding, or borders. if(d._usesBorderBox(node)){ @@ -964,7 +964,7 @@ if(dojo.isIE){ dojo._setMarginBox = function(/*DomNode*/node, /*Number?*/leftPx, /*Number?*/topPx, /*Number?*/widthPx, /*Number?*/heightPx, /*Object*/computedStyle){ - // summary: + // summary: // sets the size of the node's margin box and placement // (left/top), irrespective of box model. Think of it as a // passthrough to dojo._setBox that handles box-model vagaries for @@ -998,9 +998,9 @@ if(dojo.isIE){ // public API dojo.marginBox = function(/*DomNode|String*/node, /*Object?*/box){ - // summary: + // summary: // Getter/setter for the margin-box of node. - // description: + // description: // Getter/setter for the margin-box of node. // Returns an object in the expected format of box (regardless // if box is passed). The object might look like: @@ -1008,19 +1008,19 @@ if(dojo.isIE){ // for a node offset from its parent 50px to the left, 200px from // the top with a margin width of 300px and a margin-height of // 150px. - // node: + // node: // id or reference to DOM Node to get/set box for - // box: + // box: // If passed, denotes that dojo.marginBox() should // update/set the margin box for node. Box is an object in the // above format. All properties are optional if passed. - // example: - // Retrieve the marginbox of a passed node + // example: + // Retrieve the marginbox of a passed node // | var box = dojo.marginBox("someNodeId"); // | console.dir(box); // - // example: - // Set a node's marginbox to the size of another node + // example: + // Set a node's marginbox to the size of another node // | var box = dojo.marginBox("someNodeId"); // | dojo.marginBox("someOtherNode", box); @@ -1029,9 +1029,9 @@ if(dojo.isIE){ }; dojo.contentBox = function(/*DomNode|String*/node, /*Object?*/box){ - // summary: + // summary: // Getter/setter for the content-box of node. - // description: + // description: // Returns an object in the expected format of box (regardless if box is passed). // The object might look like: // `{ l: 50, t: 200, w: 300: h: 150 }` @@ -1042,9 +1042,9 @@ if(dojo.isIE){ // CSS values set/inherited for node. // While the getter will return top and left values, the // setter only accepts setting the width and height. - // node: + // node: // id or reference to DOM Node to get/set box for - // box: + // box: // If passed, denotes that dojo.contentBox() should // update/set the content box for node. Box is an object in the // above format, but only w (width) and h (height) are supported. @@ -1090,11 +1090,11 @@ if(dojo.isIE){ //>>excludeStart("webkitMobile", kwArgs.webkitMobile); dojo._getIeDocumentElementOffset = function(){ - // summary: + // summary: // returns the offset in x and y from the document body to the // visual edge of the page - // description: - // The following values in IE contain an offset: + // description: + // The following values in IE contain an offset: // | event.clientX // | event.clientY // | node.getBoundingClientRect().left @@ -1155,19 +1155,19 @@ if(dojo.isIE){ // FIXME: need a setter for coords or a moveTo!! dojo._abs = dojo.position = function(/*DomNode*/node, /*Boolean?*/includeScroll){ - // summary: + // summary: // Gets the position and size of the passed element relative to // the viewport (if includeScroll==false), or relative to the // document root (if includeScroll==true). // - // description: + // description: // Returns an object of the form: // { x: 100, y: 300, w: 20, h: 15 } // If includeScroll==true, the x and y values will include any // document offsets that may affect the position relative to the // viewport. // Uses the border-box model (inclusive of border and padding but - // not margin). Does not act as a setter. + // not margin). Does not act as a setter. node = byId(node); var db = d.body(), @@ -1201,12 +1201,12 @@ if(dojo.isIE){ }; dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){ - // summary: + // summary: // Deprecated: Use position() for border-box x/y/w/h // or marginBox() for margin-box w/h/l/t. // Returns an object representing a node's size and position. // - // description: + // description: // Returns an object that measures margin-box (w)idth/(h)eight // and absolute position x/y of the border-box. Also returned // is computed (l)eft and (t)op values in pixels from the @@ -1230,29 +1230,29 @@ if(dojo.isIE){ var _propNames = { // properties renamed to avoid clashes with reserved words - "class": "className", - "for": "htmlFor", + "class": "className", + "for": "htmlFor", // properties written as camelCase - tabindex: "tabIndex", - readonly: "readOnly", - colspan: "colSpan", + tabindex: "tabIndex", + readonly: "readOnly", + colspan: "colSpan", frameborder: "frameBorder", - rowspan: "rowSpan", + rowspan: "rowSpan", valuetype: "valueType" }, _attrNames = { // original attribute names classname: "class", - htmlfor: "for", + htmlfor: "for", // for IE - tabindex: "tabIndex", - readonly: "readOnly" + tabindex: "tabIndex", + readonly: "readOnly" }, _forcePropNames = { innerHTML: 1, className: 1, - htmlFor: d.isIE, - value: 1 + htmlFor: d.isIE, + value: 1 }; var _fixAttrName = function(/*String*/ name){ @@ -1270,14 +1270,14 @@ if(dojo.isIE){ // can return -1. dojo.hasAttr = function(/*DomNode|String*/node, /*String*/name){ - // summary: + // summary: // Returns true if the requested attribute is specified on the // given element, and false otherwise. - // node: + // node: // id or reference to the element to check - // name: + // name: // the name of the attribute - // returns: + // returns: // true if the requested attribute is specified on the // given element, and false otherwise var lc = name.toLowerCase(); @@ -1292,9 +1292,9 @@ if(dojo.isIE){ table: 1, tbody: 1, tfoot: 1, thead: 1, tr: 1, title: 1}; dojo.attr = function(/*DomNode|String*/node, /*String|Object*/name, /*String?*/value){ - // summary: + // summary: // Gets or sets an attribute on an HTML element. - // description: + // description: // Handles normalized getting and setting of attributes on DOM // Nodes. If 2 arguments are passed, and a the second argumnt is a // string, acts as a getter. @@ -1311,31 +1311,31 @@ if(dojo.isIE){ // should cancel form submission using `dojo.stopEvent()` on the // passed event object instead of returning a boolean value from // the handler itself. - // node: + // node: // id or reference to the element to get or set the attribute on - // name: + // name: // the name of the attribute to get or set. - // value: + // value: // The value to set for the attribute - // returns: + // returns: // when used as a getter, the value of the requested attribute // or null if that attribute does not have a specified or // default value; // // when used as a setter, the DOM node // - // example: + // example: // | // get the current value of the "foo" attribute on a node // | dojo.attr(dojo.byId("nodeId"), "foo"); // | // or we can just pass the id: // | dojo.attr("nodeId", "foo"); // - // example: + // example: // | // use attr() to set the tab index // | dojo.attr("nodeId", "tabIndex", 3); // | // - // example: + // example: // Set multiple values at once, including event handlers: // | dojo.attr("formId", { // | "foo": "bar", @@ -1355,7 +1355,7 @@ if(dojo.isIE){ // | } // | }); // - // example: + // example: // Style is s special case: Only set with an object hash of styles // | dojo.attr("someNode",{ // | id:"bar", @@ -1364,7 +1364,7 @@ if(dojo.isIE){ // | } // | }); // - // example: + // example: // Again, only set style as an object hash of styles: // | var obj = { color:"#fff", backgroundColor:"#000" }; // | dojo.attr("someNode", "style", obj); @@ -1459,21 +1459,21 @@ if(dojo.isIE){ }; dojo.removeAttr = function(/*DomNode|String*/ node, /*String*/ name){ - // summary: + // summary: // Removes an attribute from an HTML element. - // node: + // node: // id or reference to the element to remove the attribute from - // name: + // name: // the name of the attribute to remove byId(node).removeAttribute(_fixAttrName(name)); }; dojo.getNodeProp = function(/*DomNode|String*/ node, /*String*/ name){ - // summary: + // summary: // Returns an effective value of a property or an attribute. - // node: + // node: // id or reference to the element to remove the attribute from - // name: + // name: // the name of the attribute node = byId(node); var lc = name.toLowerCase(), @@ -1488,7 +1488,7 @@ if(dojo.isIE){ }; dojo.create = function(tag, attrs, refNode, pos){ - // summary: + // summary: // Create an element, allowing for optional attribute decoration // and placement. // @@ -1526,20 +1526,20 @@ if(dojo.isIE){ // returns: DomNode // // example: - // Create a DIV: + // Create a DIV: // | var n = dojo.create("div"); // // example: - // Create a DIV with content: + // Create a DIV with content: // | var n = dojo.create("div", { innerHTML:"

hi

" }); // // example: - // Place a new DIV in the BODY, with no attributes set + // Place a new DIV in the BODY, with no attributes set // | var n = dojo.create("div", null, dojo.body()); // // example: - // Create an UL, and populate it with LI's. Place the list as the first-child of a - // node with id="someId": + // Create an UL, and populate it with LI's. Place the list as the first-child of a + // node with id="someId": // | var ul = dojo.create("ul", null, "someId", "first"); // | var items = ["one", "two", "three", "four"]; // | dojo.forEach(items, function(data){ @@ -1547,11 +1547,11 @@ if(dojo.isIE){ // | }); // // example: - // Create an anchor, with an href. Place in BODY: + // Create an anchor, with an href. Place in BODY: // | dojo.create("a", { href:"foo.html", title:"Goto FOO!" }, dojo.body()); // // example: - // Create a `dojo.NodeList()` from a new element (for syntatic sugar): + // Create a `dojo.NodeList()` from a new element (for syntatic sugar): // | dojo.query(dojo.create('div')) // | .addClass("newDiv") // | .onclick(function(e){ console.log('clicked', e.target) }) @@ -1572,23 +1572,23 @@ if(dojo.isIE){ /*===== dojo.empty = function(node){ - // summary: + // summary: // safely removes all children of the node. - // node: DOMNode|String + // node: DOMNode|String // a reference to a DOM node or an id. - // example: - // Destroy node's children byId: + // example: + // Destroy node's children byId: // | dojo.empty("someId"); // - // example: - // Destroy all nodes' children in a list by reference: + // example: + // Destroy all nodes' children in a list by reference: // | dojo.query(".someNode").forEach(dojo.empty); } =====*/ d.empty = //>>excludeStart("webkitMobile", kwArgs.webkitMobile); - d.isIE ? function(node){ + d.isIE ? function(node){ node = byId(node); for(var c; c = node.lastChild;){ // intentional assignment d.destroy(c); @@ -1601,17 +1601,17 @@ if(dojo.isIE){ /*===== dojo._toDom = function(frag, doc){ - // summary: + // summary: // instantiates an HTML fragment returning the corresponding DOM. - // frag: String + // frag: String // the HTML fragment - // doc: DocumentNode? + // doc: DocumentNode? // optional document to use when creating DOM nodes, defaults to // dojo.doc if not specified. - // returns: DocumentFragment + // returns: DocumentFragment // - // example: - // Create a table row: + // example: + // Create a table row: // | var tr = dojo._toDom("First!"); } =====*/ @@ -1640,7 +1640,7 @@ if(dojo.isIE){ for(var param in tagWrap){ if(tagWrap.hasOwnProperty(param)){ var tw = tagWrap[param]; - tw.pre = param == "option" ? '' : "<" + tw.join("><") + ">"; tw.post = ""; // the last line is destructive: it reverses the array, // but we don't care at this point @@ -1648,7 +1648,7 @@ if(dojo.isIE){ } d._toDom = function(frag, doc){ - // summary: + // summary: // converts HTML string into DOM nodes. doc = doc || d.doc; @@ -1695,21 +1695,21 @@ if(dojo.isIE){ var _className = "className"; dojo.hasClass = function(/*DomNode|String*/node, /*String*/classStr){ - // summary: + // summary: // Returns whether or not the specified classes are a portion of the // class list currently applied to the node. // - // node: + // node: // String ID or DomNode reference to check the class for. // - // classStr: + // classStr: // A string class name to look for. // - // example: - // Do something if a node with id="someNode" has class="aSillyClassName" present + // example: + // Do something if a node with id="someNode" has class="aSillyClassName" present // | if(dojo.hasClass("someNode","aSillyClassName")){ ... } - return ((" "+ byId(node)[_className] +" ").indexOf(" " + classStr + " ") >= 0); // Boolean + return ((" "+ byId(node)[_className] +" ").indexOf(" " + classStr + " ") >= 0); // Boolean }; var spaces = /\s+/, a1 = [""], @@ -1728,31 +1728,31 @@ if(dojo.isIE){ }; dojo.addClass = function(/*DomNode|String*/node, /*String|Array*/classStr){ - // summary: + // summary: // Adds the specified classes to the end of the class list on the // passed node. Will not re-apply duplicate classes. // - // node: + // node: // String ID or DomNode reference to add a class string too // - // classStr: + // classStr: // A String class name to add, or several space-separated class names, // or an array of class names. // // example: - // Add a class to some node: + // Add a class to some node: // | dojo.addClass("someNode", "anewClass"); // // example: - // Add two classes at once: + // Add two classes at once: // | dojo.addClass("someNode", "firstClass secondClass"); // // example: - // Add two classes at once (using array): + // Add two classes at once (using array): // | dojo.addClass("someNode", ["firstClass", "secondClass"]); // // example: - // Available in `dojo.NodeList` for multiple additions + // Available in `dojo.NodeList` for multiple additions // | dojo.query("ul > li").addClass("firstLevel"); node = byId(node); @@ -1785,23 +1785,23 @@ if(dojo.isIE){ // will be deleted. // // example: - // Remove a class from some node: + // Remove a class from some node: // | dojo.removeClass("someNode", "firstClass"); // // example: - // Remove two classes from some node: + // Remove two classes from some node: // | dojo.removeClass("someNode", "firstClass secondClass"); // // example: - // Remove two classes from some node (using array): + // Remove two classes from some node (using array): // | dojo.removeClass("someNode", ["firstClass", "secondClass"]); // // example: - // Remove all classes from some node: + // Remove all classes from some node: // | dojo.removeClass("someNode"); // // example: - // Available in `dojo.NodeList()` for multiple removal + // Available in `dojo.NodeList()` for multiple removal // | dojo.query(".foo").removeClass("foo"); node = byId(node); @@ -1836,14 +1836,14 @@ if(dojo.isIE){ // | dojo.replaceClass("someNode", "add1 add2", "remove1 remove2"); // // example: - // Replace all classes with addMe + // Replace all classes with addMe // | dojo.replaceClass("someNode", "addMe"); // // example: - // Available in `dojo.NodeList()` for multiple toggles + // Available in `dojo.NodeList()` for multiple toggles // | dojo.query(".findMe").replaceClass("addMe", "removeMe"); - node = byId(node); + node = byId(node); fakeNode.className = node.className; dojo.removeClass(fakeNode, removeClassStr); dojo.addClass(fakeNode, addClassStr); @@ -1853,21 +1853,21 @@ if(dojo.isIE){ }; dojo.toggleClass = function(/*DomNode|String*/node, /*String|Array*/classStr, /*Boolean?*/condition){ - // summary: + // summary: // Adds a class to node if not present, or removes if present. // Pass a boolean condition if you want to explicitly add or remove. - // condition: + // condition: // If passed, true means to add the class, false means to remove. // // example: // | dojo.toggleClass("someNode", "hovered"); // // example: - // Forcefully add a class + // Forcefully add a class // | dojo.toggleClass("someNode", "hovered", true); // // example: - // Available in `dojo.NodeList()` for multiple toggles + // Available in `dojo.NodeList()` for multiple toggles // | dojo.query(".toggleMe").toggleClass("toggleMe"); if(condition === undefined){ diff --git a/_base/lang.js b/_base/lang.js index 934b2c392e..356e669c4d 100644 --- a/_base/lang.js +++ b/_base/lang.js @@ -39,7 +39,7 @@ define(["./kernel", "../has", "./sniff"], function(dojo, has){ // summary: // similar to dojo.isArray() but more permissive // description: - // Doesn't strongly test for "arrayness". Instead, settles for "isn't + // 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 @@ -213,7 +213,7 @@ define(["./kernel", "../has", "./sniff"], function(dojo, has){ dojo._toArray = //>>excludeStart("webkitMobile", kwArgs.webkitMobile); - d.isIE ? function(obj){ + d.isIE ? function(obj){ return ((obj.item) ? slow : efficient).apply(this, arguments); } : //>>excludeEnd("webkitMobile"); @@ -249,7 +249,7 @@ define(["./kernel", "../has", "./sniff"], function(dojo, has){ } if(o instanceof RegExp){ // RegExp - return new RegExp(o); // RegExp + return new RegExp(o); // RegExp } var r, i, l, s, name; if(d.isArray(o)){ @@ -270,7 +270,7 @@ define(["./kernel", "../has", "./sniff"], function(dojo, has){ } for(name in o){ // the "tobj" condition avoid copying properties in "source" - // inherited from Object.prototype. For example, if target has a custom + // inherited from Object.prototype. For example, if target has a custom // toString() method, don't overwrite it with the toString() method // that source inherited from Object.prototype s = o[name]; @@ -278,9 +278,9 @@ define(["./kernel", "../has", "./sniff"], function(dojo, has){ r[name] = d.clone(s); } } - if (has("bug-for-in-skips-shadowed")){ - var extraNames= dojo._extraNames; - for(i= extraNames.length; i;){ + if(has("bug-for-in-skips-shadowed")){ + var extraNames = dojo._extraNames; + for(i = extraNames.length; i;){ name = extraNames[--i]; s = o[name]; if(!(name in r) || (r[name] !== s && (!(name in empty) || empty[name] !== s))){ diff --git a/_base/query.js b/_base/query.js index 0c0913248f..214db9b277 100644 --- a/_base/query.js +++ b/_base/query.js @@ -75,7 +75,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu // summary: // This module defines dojo.query. - var d= dojo; + var d = dojo; var ctr = 0; if(has("webkit")){ @@ -217,7 +217,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu // NOTE: // this code is designed to run fast and compress well. Sacrifices - // to readability and maintainability have been made. Your best + // to readability and maintainability have been made. Your best // bet when hacking the tokenizer is to put The Donnas on *really* // loud (may we recommend their "Spend The Night" release?) and // just assume you're gonna make mistakes. Keep the unit tests @@ -394,7 +394,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu classes: [], // class matches may be additive, e.g.: .thinger.blah.howdy tag: null, // only one tag... oper: null, // ...or operator per component. Note that these wind up being exclusive. - id: null, // the id component of a rule + id: null, // the id component of a rule getTag: function(){ return (caseSensitive) ? this.otag : this.tag; } @@ -425,7 +425,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu // try to strip quotes from the matchFor value. We want // [attrName=howdy] to match the same // as [attrName = 'howdy' ] - if( (cmf.charAt(0) == '"') || (cmf.charAt(0) == "'") ){ + if( (cmf.charAt(0) == '"') || (cmf.charAt(0) == "'") ){ _cp.matchFor = cmf.slice(1, -1); } } @@ -954,7 +954,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu // NOTE: // this function returns a function that searches for nodes and - // filters them. The search may be specialized by infix operators + // filters them. The search may be specialized by infix operators // (">", "~", or "+") else it will default to searching all // descendants (the " " selector). Once a group of children is // found, a test function is applied to weed out the ones we @@ -1180,19 +1180,19 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu // NOTES: // * we can't trust QSA for anything but document-rooted queries, so - // caching is split into DOM query evaluators and QSA query evaluators + // caching is split into DOM query evaluators and QSA query evaluators // * caching query results is dirty and leak-prone (or, at a minimum, - // prone to unbounded growth). Other toolkits may go this route, but - // they totally destroy their own ability to manage their memory - // footprint. If we implement it, it should only ever be with a fixed - // total element reference # limit and an LRU-style algorithm since JS - // has no weakref support. Caching compiled query evaluators is also - // potentially problematic, but even on large documents the size of the - // query evaluators is often < 100 function objects per evaluator (and - // LRU can be applied if it's ever shown to be an issue). + // prone to unbounded growth). Other toolkits may go this route, but + // they totally destroy their own ability to manage their memory + // footprint. If we implement it, it should only ever be with a fixed + // total element reference # limit and an LRU-style algorithm since JS + // has no weakref support. Caching compiled query evaluators is also + // potentially problematic, but even on large documents the size of the + // query evaluators is often < 100 function objects per evaluator (and + // LRU can be applied if it's ever shown to be an issue). // * since IE's QSA support is currently only for HTML documents and even - // then only in IE 8's "standards mode", we have to detect our dispatch - // route at query time and keep 2 separate caches. Ugg. + // then only in IE 8's "standards mode", we have to detect our dispatch + // route at query time and keep 2 separate caches. Ugg. // we need to determine if we think we can run a given query via // querySelectorAll or if we'll need to fall back on DOM queries to get @@ -1223,7 +1223,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu //Don't bother with n+3 type of matches, IE complains if we modify those. var infixSpaceRe = /n\+\d|([^ ])?([>~+])([^ =])?/g; - var infixSpaceFunc = function(match, pre, ch, post) { + var infixSpaceFunc = function(match, pre, ch, post){ return ch ? (pre ? pre + " " : "") + ch + (post ? " " + post : "") : /*n+3*/ match; }; @@ -1295,7 +1295,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu try{ // the QSA system contains an egregious spec bug which // limits us, effectively, to only running QSA queries over - // entire documents. See: + // entire documents. See: // http://ejohn.org/blog/thoughts-on-queryselectorall/ // despite this, we can also handle QSA runs on simple // selectors, but we don't want detection to be expensive @@ -1473,7 +1473,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu // | * `:root`, `:lang()`, `:target`, `:focus` // * all visual and state selectors: // | * `:root`, `:active`, `:hover`, `:visisted`, `:link`, - // `:enabled`, `:disabled` + // `:enabled`, `:disabled` // * `:*-of-type` pseudo selectors // // dojo.query and XML Documents: @@ -1617,7 +1617,7 @@ define(["./kernel", "../has", "./sniff", "./NodeList", "./lang", "./window"], fu filterFunc = (parts.length == 1 && !/[^\w#\.]/.test(filter)) ? getSimpleFilterFunc(parts[0]) : - function(node) { + function(node){ return dojo.query(filter, root).indexOf(node) != -1; }; for(var x = 0, te; te = nodeList[x]; x++){