summaryrefslogtreecommitdiff
path: root/lib/dojo/_base
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-11-08 20:40:44 +0400
committerAndrew Dolgov <[email protected]>2011-11-08 20:40:44 +0400
commit81bea17aefb26859f825b9293c7c99192874806e (patch)
treefb244408ca271affa2899adb634788802c9a89d8 /lib/dojo/_base
parent870a70e109ac9e80a88047044530de53d0404ec7 (diff)
upgrade Dojo to 1.6.1
Diffstat (limited to 'lib/dojo/_base')
-rw-r--r--lib/dojo/_base/Color.js5
-rw-r--r--lib/dojo/_base/Deferred.js106
-rw-r--r--lib/dojo/_base/NodeList.js83
-rw-r--r--lib/dojo/_base/_loader/bootstrap.js33
-rw-r--r--lib/dojo/_base/_loader/hostenv_browser.js37
-rw-r--r--lib/dojo/_base/_loader/hostenv_ff_ext.js6
-rw-r--r--lib/dojo/_base/_loader/hostenv_rhino.js20
-rw-r--r--lib/dojo/_base/_loader/hostenv_spidermonkey.js22
-rw-r--r--lib/dojo/_base/_loader/loader.js176
-rw-r--r--lib/dojo/_base/_loader/loader_debug.js2
-rw-r--r--lib/dojo/_base/_loader/loader_xd.js40
-rw-r--r--lib/dojo/_base/array.js39
-rw-r--r--lib/dojo/_base/browser.js17
-rw-r--r--lib/dojo/_base/connect.js93
-rw-r--r--lib/dojo/_base/declare.js26
-rw-r--r--lib/dojo/_base/event.js124
-rw-r--r--lib/dojo/_base/fx.js3
-rw-r--r--lib/dojo/_base/html.js266
-rw-r--r--lib/dojo/_base/json.js15
-rw-r--r--lib/dojo/_base/lang.js35
-rw-r--r--lib/dojo/_base/query-sizzle.js32
-rw-r--r--lib/dojo/_base/query.js261
-rw-r--r--lib/dojo/_base/window.js20
-rw-r--r--lib/dojo/_base/xhr.js117
24 files changed, 853 insertions, 725 deletions
diff --git a/lib/dojo/_base/Color.js b/lib/dojo/_base/Color.js
index 5f5c5af9b..4707fa582 100644
--- a/lib/dojo/_base/Color.js
+++ b/lib/dojo/_base/Color.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -11,6 +11,7 @@ dojo.provide("dojo._base.Color");
dojo.require("dojo._base.array");
dojo.require("dojo._base.lang");
+
(function(){
var d = dojo;
@@ -199,7 +200,7 @@ dojo.require("dojo._base.lang");
// Builds a `dojo.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
+ // | 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.
var t = obj || new d.Color();
diff --git a/lib/dojo/_base/Deferred.js b/lib/dojo/_base/Deferred.js
index 3193024ab..c5992c966 100644
--- a/lib/dojo/_base/Deferred.js
+++ b/lib/dojo/_base/Deferred.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,42 +10,43 @@ dojo._hasResource["dojo._base.Deferred"] = true;
dojo.provide("dojo._base.Deferred");
dojo.require("dojo._base.lang");
+
(function(){
- var mutator = function(){};
+ var mutator = function(){};
var freeze = Object.freeze || function(){};
// A deferred provides an API for creating and resolving a promise.
dojo.Deferred = function(/*Function?*/canceller){
// summary:
// Deferreds provide a generic means for encapsulating an asynchronous
- // operation and notifying users of the completion and result of the operation.
+ // operation and notifying users of the completion and result of the operation.
// description:
// The dojo.Deferred API is based on the concept of promises that provide a
// generic interface into the eventual completion of an asynchronous action.
- // The motivation for promises fundamentally is about creating a
- // separation of concerns that allows one to achieve the same type of
- // call patterns and logical data flow in asynchronous code as can be
- // achieved in synchronous code. Promises allows one
- // to be able to call a function purely with arguments needed for
- // execution, without conflating the call with concerns of whether it is
- // sync or async. One shouldn't need to alter a call's arguments if the
- // implementation switches from sync to async (or vice versa). By having
- // async functions return promises, the concerns of making the call are
- // separated from the concerns of asynchronous interaction (which are
+ // The motivation for promises fundamentally is about creating a
+ // separation of concerns that allows one to achieve the same type of
+ // call patterns and logical data flow in asynchronous code as can be
+ // achieved in synchronous code. Promises allows one
+ // to be able to call a function purely with arguments needed for
+ // execution, without conflating the call with concerns of whether it is
+ // sync or async. One shouldn't need to alter a call's arguments if the
+ // implementation switches from sync to async (or vice versa). By having
+ // async functions return promises, the concerns of making the call are
+ // separated from the concerns of asynchronous interaction (which are
// handled by the promise).
- //
- // The dojo.Deferred is a type of promise that provides methods for fulfilling the
- // promise with a successful result or an error. The most important method for
- // working with Dojo's promises is the then() method, which follows the
+ //
+ // The dojo.Deferred is a type of promise that provides methods for fulfilling the
+ // promise with a successful result or an error. The most important method for
+ // working with Dojo's promises is the then() method, which follows the
// CommonJS proposed promise API. An example of using a Dojo promise:
- //
+ //
// | var resultingPromise = someAsyncOperation.then(function(result){
// | ... handle result ...
// | },
// | function(error){
// | ... handle error ...
// | });
- //
- // The .then() call returns a new promise that represents the result of the
+ //
+ // The .then() call returns a new promise that represents the result of the
// execution of the callback. The callbacks will never affect the original promises value.
//
// The dojo.Deferred instances also provide the following functions for backwards compatibility:
@@ -55,7 +56,7 @@ dojo.require("dojo._base.lang");
// * callback(result)
// * errback(result)
//
- // Callbacks are allowed to return promisesthemselves, so
+ // 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
@@ -115,7 +116,7 @@ dojo.require("dojo._base.lang");
// | renderDataitem(data[x]);
// | }
// | d.callback(true);
- // | }catch(e){
+ // | }catch(e){
// | d.errback(new Error("rendering failed"));
// | }
// | return d;
@@ -129,7 +130,7 @@ dojo.require("dojo._base.lang");
// | // again, so we could chain adding callbacks or save the
// | // deferred for later should we need to be notified again.
// example:
- // In this example, renderLotsOfData is syncrhonous and so both
+ // In this example, renderLotsOfData is synchronous and so both
// versions are pretty artificial. Putting the data display on a
// timeout helps show why Deferreds rock:
//
@@ -142,7 +143,7 @@ dojo.require("dojo._base.lang");
// | renderDataitem(data[x]);
// | }
// | d.callback(true);
- // | }catch(e){
+ // | }catch(e){
// | d.errback(new Error("rendering failed"));
// | }
// | }, 100);
@@ -157,11 +158,11 @@ dojo.require("dojo._base.lang");
// Note that the caller doesn't have to change his code at all to
// handle the asynchronous case.
var result, finished, isError, head, nextListener;
- var promise = this.promise = {};
+ var promise = (this.promise = {});
function complete(value){
if(finished){
- throw new Error("This deferred has already been resolved");
+ throw new Error("This deferred has already been resolved");
}
result = value;
finished = true;
@@ -172,7 +173,7 @@ dojo.require("dojo._base.lang");
while(!mutated && nextListener){
var listener = nextListener;
nextListener = nextListener.next;
- if(mutated = (listener.progress == mutator)){ // assignment and check
+ if((mutated = (listener.progress == mutator))){ // assignment and check
finished = false;
}
var func = (isError ? listener.error : listener.resolved);
@@ -184,6 +185,9 @@ dojo.require("dojo._base.lang");
continue;
}
var unchanged = mutated && newResult === undefined;
+ if(mutated && !unchanged){
+ isError = newResult instanceof Error;
+ }
listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
}
catch (e) {
@@ -196,7 +200,7 @@ dojo.require("dojo._base.lang");
listener.deferred.resolve(result);
}
}
- }
+ }
}
// calling resolve will resolve the promise
this.resolve = this.callback = function(value){
@@ -211,7 +215,7 @@ dojo.require("dojo._base.lang");
// calling error will indicate that the promise failed
this.reject = this.errback = function(error){
// summary:
- // Fulfills the Deferred instance as an error with the provided error
+ // Fulfills the Deferred instance as an error with the provided error
isError = true;
this.fired = 1;
complete(error);
@@ -228,7 +232,7 @@ dojo.require("dojo._base.lang");
while(listener){
var progress = listener.progress;
progress && progress(update);
- listener = listener.next;
+ listener = listener.next;
}
};
this.addCallbacks = function(/*Function?*/callback, /*Function?*/errback){
@@ -237,35 +241,35 @@ dojo.require("dojo._base.lang");
};
// provide the implementation of the promise
this.then = promise.then = function(/*Function?*/resolvedCallback, /*Function?*/errorCallback, /*Function?*/progressCallback){
- // summary
- // Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
- // completion of a promise. The fulfilledHandler is called when the promise
- // is fulfilled. The errorHandler is called when a promise fails. The
- // progressHandler is called for progress events. All arguments are optional
- // and non-function values are ignored. The progressHandler is not only an
- // optional argument, but progress events are purely optional. Promise
+ // summary:
+ // Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
+ // completion of a promise. The fulfilledHandler is called when the promise
+ // is fulfilled. The errorHandler is called when a promise fails. The
+ // progressHandler is called for progress events. All arguments are optional
+ // and non-function values are ignored. The progressHandler is not only an
+ // optional argument, but progress events are purely optional. Promise
// providers are not required to ever create progress events.
- //
- // This function will return a new promise that is fulfilled when the given
- // fulfilledHandler or errorHandler callback is finished. This allows promise
- // operations to be chained together. The value returned from the callback
- // handler is the fulfillment value for the returned promise. If the callback
+ //
+ // This function will return a new promise that is fulfilled when the given
+ // fulfilledHandler or errorHandler callback is finished. This allows promise
+ // operations to be chained together. The value returned from the callback
+ // handler is the fulfillment value for the returned promise. If the callback
// throws an error, the returned promise will be moved to failed state.
- //
+ //
// example:
// An example of using a CommonJS compliant promise:
// | asyncComputeTheAnswerToEverything().
// | then(addTwo).
// | then(printResult, onError);
- // | >44
- //
+ // | >44
+ //
var returnDeferred = progressCallback == mutator ? this : new dojo.Deferred(promise.cancel);
var listener = {
- resolved: resolvedCallback,
- error: errorCallback,
- progress: progressCallback,
+ resolved: resolvedCallback,
+ error: errorCallback,
+ progress: progressCallback,
deferred: returnDeferred
- };
+ };
if(nextListener){
head = head.next = listener;
}
@@ -291,7 +295,7 @@ dojo.require("dojo._base.lang");
deferred.reject(error);
}
}
- }
+ };
freeze(promise);
};
dojo.extend(dojo.Deferred, {
@@ -312,7 +316,7 @@ dojo.require("dojo._base.lang");
})();
dojo.when = function(promiseOrValue, /*Function?*/callback, /*Function?*/errback, /*Function?*/progressHandler){
// summary:
- // This provides normalization between normal synchronous values and
+ // This provides normalization between normal synchronous values and
// asynchronous promises, so you can interact with them in a common way
// example:
// | function printFirstAndList(items){
diff --git a/lib/dojo/_base/NodeList.js b/lib/dojo/_base/NodeList.js
index 12b631a4b..8cdc1c0f7 100644
--- a/lib/dojo/_base/NodeList.js
+++ b/lib/dojo/_base/NodeList.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,6 +10,9 @@ dojo._hasResource["dojo._base.NodeList"] = true;
dojo.provide("dojo._base.NodeList");
dojo.require("dojo._base.lang");
dojo.require("dojo._base.array");
+dojo.require("dojo._base.connect");
+dojo.require("dojo._base.html");
+
(function(){
@@ -248,7 +251,7 @@ dojo.require("dojo._base.array");
});
// add forEach actions
- d.forEach(["connect", "addClass", "removeClass", "toggleClass", "empty", "removeAttr"], function(name){
+ d.forEach(["connect", "addClass", "removeClass", "replaceClass", "toggleClass", "empty", "removeAttr"], function(name){
nlp[name] = adaptAsForEach(d[name]);
});
@@ -306,7 +309,7 @@ dojo.require("dojo._base.array");
_cloneNode: function(/*DOMNode*/ node){
// summary:
- // private utiltity to clone a node. Not very interesting in the vanilla
+ // private utility to clone a node. Not very interesting in the vanilla
// dojo.NodeList case, but delegates could do interesting things like
// clone event handlers if that is derivable from the node.
return node.cloneNode(true);
@@ -400,7 +403,7 @@ dojo.require("dojo._base.array");
if(this._parent){
return this._parent;
}else{
- //Just return empy list.
+ //Just return empty list.
return new this._NodeListCtor();
}
},
@@ -468,12 +471,12 @@ dojo.require("dojo._base.array");
indexOf: function(value, fromIndex){
// summary:
- // see dojo.indexOf(). The primary difference is that the acted-on
+ // 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 loction to start searching from. Optional. Defaults to 0.
+ // The location to start searching from. Optional. Defaults to 0.
// description:
// For more details on the behavior of indexOf, see Mozilla's
// (indexOf
@@ -494,7 +497,7 @@ dojo.require("dojo._base.array");
// value: Object
// The value to search for.
// fromIndex: Integer?
- // The loction to start searching from. Optional. Defaults to 0.
+ // The location to start searching from. Optional. Defaults to 0.
// returns:
// Positive Integer or 0 for a match, -1 of not found.
return d.lastIndexOf(this, value, fromIndex); // Integer
@@ -572,12 +575,12 @@ dojo.require("dojo._base.array");
forEach: function(callback, thisObj){
// summary:
- // see `dojo.forEach()`. The primary difference is that the acted-on
+ // 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.
d.forEach(this, callback, thisObj);
// non-standard return to allow easier chaining
- return this; // dojo.NodeList
+ return this; // dojo.NodeList
},
/*=====
@@ -594,7 +597,7 @@ dojo.require("dojo._base.array");
// 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.
+ // assumes the node passed is each node in this list.
return d.map(this, d.position); // Array
},
@@ -617,7 +620,7 @@ dojo.require("dojo._base.array");
// Disable a group of buttons:
// | dojo.query("button.group").attr("disabled", true);
// example:
- // innerHTML can be assigned or retreived as well:
+ // 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");
return; // dojo.NodeList
@@ -682,7 +685,7 @@ dojo.require("dojo._base.array");
// 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
+ // (methodName, objOrFunc, funcName), objOrFunc must be the scope to
// locate the bound function in
// funcName: String?
// optional. A string naming the function in objOrFunc to bind to the
@@ -728,7 +731,7 @@ dojo.require("dojo._base.array");
// by queryOrNode. Returns the original NodeList. See: `dojo.place`
// 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
+ // In the selector case, only the first matching element will be used
// for relative positioning.
// position:
// can be one of:
@@ -743,18 +746,15 @@ dojo.require("dojo._base.array");
return this.forEach(function(node){ d.place(node, item, position); }); // dojo.NodeList
},
- orphan: function(/*String?*/ simpleFilter){
+ orphan: function(/*String?*/ filter){
// summary:
- // removes elements in this list that match the simple filter
+ // removes elements in this list that match the filter
// from their parents and returns them as a new NodeList.
- // simpleFilter:
- // single-expression CSS rule. For example, ".thinger" or
- // "#someId[attrName='value']" but not "div > span". In short,
- // anything which does not invoke a descent to evaluate but
- // can instead be used to test a single node is acceptable.
+ // filter:
+ // CSS selector like ".foo" or "div > span"
// returns:
- // `dojo.NodeList` containing the orpahned elements
- return (simpleFilter ? d._filterQueryResult(this, simpleFilter) : this).forEach(orphan); // dojo.NodeList
+ // `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){
@@ -781,7 +781,7 @@ dojo.require("dojo._base.array");
// FIXME: do we need this?
query: function(/*String*/ queryStr){
// summary:
- // Returns a new list whose memebers match the passed query,
+ // Returns a new list whose members match the passed query,
// assuming elements of the current NodeList as the root for
// each search.
// example:
@@ -792,9 +792,9 @@ dojo.require("dojo._base.array");
// | </p>
// | </div>
// | <div id="bar">
- // | <p>great commedians may not be funny <span>in person</span></p>
+ // | <p>great comedians may not be funny <span>in person</span></p>
// | </div>
- // If we are presented with the following defintion for a NodeList:
+ // If we are presented with the following definition for a NodeList:
// | 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:
@@ -809,18 +809,14 @@ dojo.require("dojo._base.array");
return this._wrap(apc.apply([], ret), this); // dojo.NodeList
},
- filter: function(/*String|Function*/ simpleFilter){
+ filter: function(/*String|Function*/ filter){
// 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.
- // simpleFilter:
- // If a string, a single-expression CSS rule. For example,
- // ".thinger" or "#someId[attrName='value']" but not "div >
- // span". In short, anything which does not invoke a descent
- // to evaluate but can instead be used to test a single node
- // is acceptable.
+ // filter:
+ // If a string, a CSS rule like ".thinger" or "div > span".
// example:
// "regular" JS filter syntax as exposed in dojo.filter:
// | dojo.query("*").filter(function(item){
@@ -832,7 +828,7 @@ dojo.require("dojo._base.array");
// | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
var a = arguments, items = this, start = 0;
- if(typeof simpleFilter == "string"){ // inline'd type check
+ if(typeof filter == "string"){ // inline'd type check
items = d._filterQueryResult(this, a[0]);
if(a.length == 1){
// if we only got a string query, pass back the filtered results
@@ -880,10 +876,10 @@ dojo.require("dojo._base.array");
// | "before"
// | "after"
// | "replace" (replaces nodes in this NodeList with new content)
- // | "only" (removes other children of the nodes so new content is hte only child)
+ // | "only" (removes other children of the nodes so new content is the only child)
// or an offset in the childNodes property
// example:
- // appends content to the end if the position is ommitted
+ // appends content to the end if the position is omitted
// | dojo.query("h3 > p").addContent("hey there!");
// example:
// add something to the front of each element that has a
@@ -914,7 +910,7 @@ dojo.require("dojo._base.array");
// text: "Send"
// });
content = this._normalize(content, this[0]);
- for(var i = 0, node; node = this[i]; i++){
+ for(var i = 0, node; (node = this[i]); i++){
this._place(content, node, position, i > 0);
}
return this; //dojo.NodeList
@@ -943,11 +939,11 @@ dojo.require("dojo._base.array");
// 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.
+ // list and go backwards.
//
// example:
// Shorten the list to the first, second, and third elements
- // | dojo.query("a").at(0, 1, 2).forEach(fn);
+ // | dojo.query("a").at(0, 1, 2).forEach(fn);
//
// example:
// Retrieve the first and last elements of a unordered list:
@@ -957,13 +953,13 @@ dojo.require("dojo._base.array");
// 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.
- // | })
+ // | console.log(n); // all anchors on the page.
+ // | })
//
// returns:
// dojo.NodeList
var t = new this._NodeListCtor();
- d.forEach(arguments, function(i){
+ d.forEach(arguments, function(i){
if(i < 0){ i = this.length + i }
if(this[i]){ t.push(this[i]); }
}, this);
@@ -973,7 +969,8 @@ dojo.require("dojo._base.array");
});
nl.events = [
- // summary: list of all DOM events used in NodeList
+ // summary:
+ // list of all DOM events used in NodeList
"blur", "focus", "change", "click", "error", "keydown", "keypress",
"keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove",
"mouseout", "mouseover", "mouseup", "submit"
@@ -986,7 +983,7 @@ dojo.require("dojo._base.array");
var _oe = "on" + evt;
nlp[_oe] = function(a, b){
return this.connect(_oe, a, b);
- }
+ };
// FIXME: should these events trigger publishes?
/*
return (a ? this.connect(_oe, a, b) :
diff --git a/lib/dojo/_base/_loader/bootstrap.js b/lib/dojo/_base/_loader/bootstrap.js
index 3ef3012a2..a1f99276a 100644
--- a/lib/dojo/_base/_loader/bootstrap.js
+++ b/lib/dojo/_base/_loader/bootstrap.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -76,7 +76,7 @@ djConfig = {
// of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
// modules may be configured via `djConfig.modulePaths`.
modulePaths: {},
- // afterOnLoad: Boolean
+ // afterOnLoad: Boolean
// Indicates Dojo was added to the page after the page load. In this case
// Dojo will not wait for the page DOMContentLoad/load events and fire
// its dojo.addOnLoad callbacks after making sure all outstanding
@@ -103,7 +103,7 @@ djConfig = {
// dojoBlankHtmlUrl: String
// Used by some modules to configure an empty iframe. Used by dojo.io.iframe and
// dojo.back, and dijit popup support in IE where an iframe is needed to make sure native
- // controls do not bleed through the popups. Normally this configuration variable
+ // controls do not bleed through the popups. Normally this configuration variable
// does not need to be set, except when using cross-domain/CDN Dojo builds.
// Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
// to the path on your domain your copy of blank.html.
@@ -149,7 +149,7 @@ djConfig = {
"groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
"trace", "warn", "log"
];
- var i=0, tn;
+ var i = 0, tn;
while((tn=cn[i++])){
if(!console[tn]){
(function(){
@@ -209,9 +209,13 @@ dojo.global = {
debugAtAllCosts: false
};
- if(typeof djConfig != "undefined"){
- for(var opt in djConfig){
- d.config[opt] = djConfig[opt];
+ // FIXME: 2.0, drop djConfig support. Use dojoConfig exclusively for global config.
+ var cfg = typeof djConfig != "undefined" ? djConfig :
+ typeof dojoConfig != "undefined" ? dojoConfig : null;
+
+ if(cfg){
+ for(var c in cfg){
+ d.config[c] = cfg[c];
}
}
@@ -223,7 +227,7 @@ dojo.global = {
=====*/
dojo.locale = d.config.locale;
- var rev = "$Rev: 22487 $".match(/\d+/);
+ var rev = "$Rev: 24595 $".match(/\d+/);
/*=====
dojo.version = function(){
@@ -247,7 +251,7 @@ dojo.global = {
}
=====*/
dojo.version = {
- major: 1, minor: 5, patch: 0, flag: "",
+ major: 1, minor: 6, patch: 1, flag: "",
revision: rev ? +rev[0] : NaN,
toString: function(){
with(d.version){
@@ -323,7 +327,7 @@ dojo.global = {
// | constructor: function(properties){
// | // property configuration:
// | dojo.mixin(this, properties);
- // |
+ // |
// | console.log(this.quip);
// | // ...
// | },
@@ -344,7 +348,7 @@ dojo.global = {
// | name: "Carl Brutanananadilewski"
// | }
// | );
- // |
+ // |
// | // will print "Carl Brutanananadilewski"
// | console.log(flattened.name);
// | // will print "true"
@@ -419,10 +423,7 @@ dojo.global = {
// determine if an object supports a given method
// description:
// useful for longer api chains where you have to test each object in
- // the chain. Useful only for object and method detection.
- // Not useful for testing generic properties on an object.
- // In particular, dojo.exists("foo.bar") when foo.bar = ""
- // will return false. Use ("bar" in foo) to test for those cases.
+ // the chain. Useful for object and method detection.
// name:
// Path to an object, in the form "A.B.C".
// obj:
@@ -441,7 +442,7 @@ dojo.global = {
// | // search from a particular scope
// | dojo.exists("bar", foo); // true
// | dojo.exists("bar.baz", foo); // false
- return !!d.getObject(name, false, obj); // Boolean
+ return d.getObject(name, false, obj) !== undefined; // Boolean
}
dojo["eval"] = function(/*String*/ scriptFragment){
diff --git a/lib/dojo/_base/_loader/hostenv_browser.js b/lib/dojo/_base/_loader/hostenv_browser.js
index 7d92d70e3..b31bd77dc 100644
--- a/lib/dojo/_base/_loader/hostenv_browser.js
+++ b/lib/dojo/_base/_loader/hostenv_browser.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -26,9 +26,9 @@ dojo.isIE = {
dojo.isSafari = {
// example:
// | if(dojo.isSafari){ ... }
- // example:
+ // example:
// Detect iPhone:
- // | if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){
+ // | if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){
// | // we are iPhone. Note, iPod touch reports "iPod" above and fails this test.
// | }
};
@@ -71,7 +71,6 @@ dojo = {
// True if the client runs on Mac
}
=====*/
-
if(typeof window != 'undefined'){
dojo.isBrowser = true;
dojo._name = "browser";
@@ -98,7 +97,7 @@ if(typeof window != 'undefined'){
d.config.baseUrl = src.substring(0, m.index);
}
// and find out if we need to modify our behavior
- var cfg = scripts[i].getAttribute("djConfig");
+ var cfg = (scripts[i].getAttribute("djConfig") || scripts[i].getAttribute("data-dojo-config"));
if(cfg){
var cfgo = eval("({ "+cfg+" })");
for(var x in cfgo){
@@ -172,7 +171,7 @@ if(typeof window != 'undefined'){
d._XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
d._xhrObj = function(){
- // summary:
+ // summary:
// does the work of portably generating a new XMLHTTPRequest object.
var http, last_e;
if(!dojo.isIE || !dojo.config.ieForceActiveXXhr){
@@ -205,10 +204,11 @@ if(typeof window != 'undefined'){
var stat = http.status || 0,
lp = location.protocol;
return (stat >= 200 && stat < 300) || // Boolean
- stat == 304 || // allow any 2XX response code
- stat == 1223 || // get it out of the cache
+ stat == 304 || // allow any 2XX response code
+ stat == 1223 || // get it out of the cache
+ // Internet Explorer mangled the status code
// Internet Explorer mangled the status code OR we're Titanium/browser chrome/chrome extension requesting a local file
- (!stat && (lp == "file:" || lp == "chrome:" || lp == "chrome-extension:" || lp == "app:") );
+ (!stat && (lp == "file:" || lp == "chrome:" || lp == "chrome-extension:" || lp == "app:"));
}
//See if base tag is in use.
@@ -303,7 +303,7 @@ if(typeof window != 'undefined'){
d.addOnWindowUnload = function(/*Object?|Function?*/obj, /*String|Function?*/functionName){
// summary:
// registers a function to be triggered when window.onunload
- // fires.
+ // fires.
// description:
// The first time that addOnWindowUnload is called Dojo
// will register a page listener to trigger your unload
@@ -334,7 +334,7 @@ if(typeof window != 'undefined'){
// description:
// The first time that addOnUnload is called Dojo will
// register a page listener to trigger your unload handler
- // with.
+ // with.
//
// In a browser enviroment, the functions will be triggered
// during the window.onbeforeunload event. Be careful of doing
@@ -347,7 +347,7 @@ if(typeof window != 'undefined'){
//
// Further note that calling dojo.addOnUnload will prevent
// browsers from using a "fast back" cache to make page
- // loading via back button instantaneous.
+ // loading via back button instantaneous.
// example:
// | dojo.addOnUnload(functionPointer)
// | dojo.addOnUnload(object, "functionName")
@@ -384,7 +384,7 @@ if(typeof window != 'undefined'){
}
}
- if(!dojo.config.afterOnLoad){
+ if(!dojo.config.afterOnLoad){
if(document.addEventListener){
//Standards. Hooray! Assumption here that if standards based,
//it knows about DOMContentLoaded. It is OK if it does not, the fall through
@@ -401,10 +401,10 @@ if(typeof window != 'undefined'){
if(!dojo.config.skipIeDomLoaded && self === self.top){
dojo._scrollIntervalId = setInterval(function (){
try{
- //When dojo is loaded into an iframe in an IE HTML Application
+ //When dojo is loaded into an iframe in an IE HTML Application
//(HTA), such as in a selenium test, javascript in the iframe
//can't see anything outside of it, so self===self.top is true,
- //but the iframe is not the top window and doScroll will be
+ //but the iframe is not the top window and doScroll will be
//available before document.body is set. Test document.body
//before trying the doScroll trick
if(document.body){
@@ -467,8 +467,11 @@ if(dojo.config.isDebug){
}
if(dojo.config.debugAtAllCosts){
- dojo.config.useXDomain = true;
- dojo.require("dojo._base._loader.loader_xd");
+ // this breaks the new AMD based module loader. The XDomain won't be necessary
+ // anyway if you switch to the asynchronous loader
+ //dojo.config.useXDomain = true;
+ //dojo.require("dojo._base._loader.loader_xd");
dojo.require("dojo._base._loader.loader_debug");
dojo.require("dojo.i18n");
}
+
diff --git a/lib/dojo/_base/_loader/hostenv_ff_ext.js b/lib/dojo/_base/_loader/hostenv_ff_ext.js
index 94a0a8046..ca47a4c1c 100644
--- a/lib/dojo/_base/_loader/hostenv_ff_ext.js
+++ b/lib/dojo/_base/_loader/hostenv_ff_ext.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -241,7 +241,7 @@ if(typeof window != 'undefined'){
return oc;
};
- // FIXME:
+ // FIXME:
// don't really like the current arguments and order to
// _inContext, so don't make it public until it's right!
dojo._inContext = function(g, d, f){
@@ -302,7 +302,7 @@ if(typeof window != 'undefined'){
// Dojo's to fire once..but we might care if pages navigate. We'll
// probably need an extension-specific API
if(!dojo.config.afterOnLoad){
- window.addEventListener("DOMContentLoaded",function(e){
+ window.addEventListener("DOMContentLoaded",function(e){
dojo._loadInit(e);
// console.log("DOM content loaded", e);
}, false);
diff --git a/lib/dojo/_base/_loader/hostenv_rhino.js b/lib/dojo/_base/_loader/hostenv_rhino.js
index ee9ad8b43..e3aa78524 100644
--- a/lib/dojo/_base/_loader/hostenv_rhino.js
+++ b/lib/dojo/_base/_loader/hostenv_rhino.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -58,6 +58,9 @@ dojo._isLocalUrl = function(/*String*/ uri) {
// see comments in spidermonkey loadUri
dojo._loadUri = function(uri, cb){
+ if(dojo._loadedUrls[uri]){
+ return true; // Boolean
+ }
try{
var local;
try{
@@ -67,29 +70,32 @@ dojo._loadUri = function(uri, cb){
return false;
}
+ dojo._loadedUrls[uri] = true;
//FIXME: Use Rhino 1.6 native readFile/readUrl if available?
if(cb){
var contents = (local ? readText : readUri)(uri, "UTF-8");
// patch up the input to eval until https://bugzilla.mozilla.org/show_bug.cgi?id=471005 is fixed.
if(!eval("'\u200f'").length){
- contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){
- return "\\u" + match.charCodeAt(0).toString(16);
+ contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){
+ return "\\u" + match.charCodeAt(0).toString(16);
})
}
-
- cb(eval('('+contents+')'));
+ contents = /^define\(/.test(contents) ? contents : '('+contents+')';
+ cb(eval(contents));
}else{
load(uri);
}
+ dojo._loadedUrls.push(uri);
return true;
}catch(e){
+ dojo._loadedUrls[uri] = false;
console.debug("rhino load('" + uri + "') failed. Exception: " + e);
return false;
}
}
-dojo.exit = function(exitcode){
+dojo.exit = function(exitcode){
quit(exitcode);
}
@@ -157,7 +163,7 @@ dojo._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
dojo.doc = typeof document != "undefined" ? document : null;
dojo.body = function(){
- return document.body;
+ return document.body;
}
// Supply setTimeout/clearTimeout implementations if they aren't already there
diff --git a/lib/dojo/_base/_loader/hostenv_spidermonkey.js b/lib/dojo/_base/_loader/hostenv_spidermonkey.js
index 17b21f5f0..a3d2dfc6f 100644
--- a/lib/dojo/_base/_loader/hostenv_spidermonkey.js
+++ b/lib/dojo/_base/_loader/hostenv_spidermonkey.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -19,13 +19,13 @@ dojo._name = 'spidermonkey';
/*=====
dojo.isSpidermonkey = {
- // summary: Detect spidermonkey
+ // summary: Detect spidermonkey
};
=====*/
dojo.isSpidermonkey = true;
-dojo.exit = function(exitcode){
- quit(exitcode);
+dojo.exit = function(exitcode){
+ quit(exitcode);
}
if(typeof print == "function"){
@@ -37,15 +37,15 @@ if(typeof line2pc == 'undefined'){
}
dojo._spidermonkeyCurrentFile = function(depth){
- //
+ //
// This is a hack that determines the current script file by parsing a
// generated stack trace (relying on the non-standard "stack" member variable
// of the SpiderMonkey Error object).
- //
+ //
// If param depth is passed in, it'll return the script file which is that far down
// the stack, but that does require that you know how deep your stack is when you are
// calling.
- //
+ //
var s = '';
try{
throw Error("whatever");
@@ -54,23 +54,23 @@ dojo._spidermonkeyCurrentFile = function(depth){
}
// lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
var matches = s.match(/[^@]*\.js/gi);
- if(!matches){
+ if(!matches){
throw Error("could not parse stack string: '" + s + "'");
}
var fname = (typeof depth != 'undefined' && depth) ? matches[depth + 1] : matches[matches.length - 1];
- if(!fname){
+ if(!fname){
throw Error("could not find file name in stack string '" + s + "'");
}
//print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
return fname;
}
-// print(dojo._spidermonkeyCurrentFile(0));
+// print(dojo._spidermonkeyCurrentFile(0));
dojo._loadUri = function(uri){
// spidermonkey load() evaluates the contents into the global scope (which
// is what we want).
- // TODO: sigh, load() does not return a useful value.
+ // TODO: sigh, load() does not return a useful value.
// Perhaps it is returning the value of the last thing evaluated?
var ok = load(uri);
// console.log("spidermonkey load(", uri, ") returned ", ok);
diff --git a/lib/dojo/_base/_loader/loader.js b/lib/dojo/_base/_loader/loader.js
index 9206de888..73df544fa 100644
--- a/lib/dojo/_base/_loader/loader.js
+++ b/lib/dojo/_base/_loader/loader.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -11,9 +11,8 @@ dojo._hasResource["dojo.foo"] = true;
* loader.js - A bootstrap module. Runs before the hostenv_*.js file. Contains
* all of the package loading methods.
*/
-
(function(){
- var d = dojo;
+ var d = dojo, currentModule;
d.mixin(d, {
_loadedModules: {},
@@ -45,11 +44,11 @@ dojo._hasResource["dojo.foo"] = true;
_loadedUrls: [],
- //WARNING:
+ //WARNING:
// This variable is referenced by packages outside of bootstrap:
// FloatingPane.js and undo/browser.js
_postLoad: false,
-
+
//Egad! Lots of test files push on this directly instead of using dojo.addOnLoad.
_loaders: [],
_unloaders: [],
@@ -68,21 +67,24 @@ dojo._hasResource["dojo.foo"] = true;
// not caught by us, so the caller will see it. We return a true
// value if and only if the script is found.
//
- // relpath:
+ // relpath:
// A relative path to a script (no leading '/', and typically ending
// in '.js').
- // module:
+ // module:
// A module whose existance to check for after loading a path. Can be
// used to determine success or failure of the load.
- // cb:
+ // cb:
// a callback function to pass the result of evaluating the script
var uri = ((relpath.charAt(0) == '/' || relpath.match(/^\w+:/)) ? "" : d.baseUrl) + relpath;
try{
+ currentModule = module;
return !module ? d._loadUri(uri, cb) : d._loadUriAndCheck(uri, module, cb); // Boolean
}catch(e){
console.error(e);
return false; // Boolean
+ }finally{
+ currentModule = null;
}
}
@@ -95,7 +97,7 @@ dojo._hasResource["dojo.foo"] = true;
// it succeeded. Returns false if the URI reading failed. Throws if
// the evaluation throws.
// uri: a uri which points at the script to be loaded
- // cb:
+ // cb:
// a callback function to process the result of evaluating the script
// as an expression, typically used by the resource bundle loader to
// load JSON-style resources
@@ -109,7 +111,8 @@ dojo._hasResource["dojo.foo"] = true;
d._loadedUrls[uri] = true;
d._loadedUrls.push(uri);
if(cb){
- contents = '('+contents+')';
+ //conditional to support script-inject i18n bundle format
+ contents = /^define\(/.test(contents) ? contents : '('+contents+')';
}else{
//Only do the scoping if no callback. If a callback is specified,
//it is most likely the i18n bundle stuff.
@@ -121,16 +124,16 @@ dojo._hasResource["dojo.foo"] = true;
}
// Check to see if we need to call _callLoaded() due to an addOnLoad() that arrived while we were busy downloading
if(--d._inFlightCount == 0 && d._postLoad && d._loaders.length){
- // We shouldn't be allowed to get here but Firefox allows an event
- // (mouse, keybd, async xhrGet) to interrupt a synchronous xhrGet.
+ // We shouldn't be allowed to get here but Firefox allows an event
+ // (mouse, keybd, async xhrGet) to interrupt a synchronous xhrGet.
// If the current script block contains multiple require() statements, then after each
// require() returns, inFlightCount == 0, but we want to hold the _callLoaded() until
// all require()s are done since the out-of-sequence addOnLoad() presumably needs them all.
// setTimeout allows the next require() to start (if needed), and then we check this again.
- setTimeout(function(){
- // If inFlightCount > 0, then multiple require()s are running sequentially and
+ setTimeout(function(){
+ // If inFlightCount > 0, then multiple require()s are running sequentially and
// the next require() started after setTimeout() was executed but before we got here.
- if(d._inFlightCount == 0){
+ if(d._inFlightCount == 0){
d._callLoaded();
}
}, 0);
@@ -153,10 +156,10 @@ dojo._hasResource["dojo.foo"] = true;
dojo.loaded = function(){
// summary:
// signal fired when initial environment and package loading is
- // complete. You should use dojo.addOnLoad() instead of doing a
+ // complete. You should use dojo.addOnLoad() instead of doing a
// direct dojo.connect() to this method in order to handle
// initialization tasks that require the environment to be
- // initialized. In a browser host, declarative widgets will
+ // initialized. In a browser host, declarative widgets will
// be constructed when this function finishes runing.
d._loadNotifying = true;
d._postLoad = true;
@@ -183,8 +186,8 @@ dojo._hasResource["dojo.foo"] = true;
dojo.unloaded = function(){
// summary:
// signal fired by impending environment destruction. You should use
- // dojo.addOnUnload() instead of doing a direct dojo.connect() to this
- // method to perform page/application cleanup methods. See
+ // dojo.addOnUnload() instead of doing a direct dojo.connect() to this
+ // method to perform page/application cleanup methods. See
// dojo.addOnUnload for more info.
var mll = d._unloaders;
while(mll.length){
@@ -203,13 +206,13 @@ dojo._hasResource["dojo.foo"] = true;
dojo.ready = dojo.addOnLoad = function(/*Object*/obj, /*String|Function?*/functionName){
// summary:
- // Registers a function to be triggered after the DOM and dojo.require() calls
+ // Registers a function to be triggered after the DOM and dojo.require() calls
// have finished loading.
//
// description:
// Registers a function to be triggered after the DOM has finished
- // loading and `dojo.require` modules have loaded. Widgets declared in markup
- // have been instantiated if `djConfig.parseOnLoad` is true when this fires.
+ // loading and `dojo.require` modules have loaded. Widgets declared in markup
+ // have been instantiated if `djConfig.parseOnLoad` is true when this fires.
//
// Images and CSS files may or may not have finished downloading when
// the specified function is called. (Note that widgets' CSS and HTML
@@ -252,7 +255,7 @@ dojo._hasResource["dojo.foo"] = true;
dojo._modulesLoaded = function(){
if(d._postLoad){ return; }
- if(d._inFlightCount > 0){
+ if(d._inFlightCount > 0){
console.warn("files still in flight!");
return;
}
@@ -284,8 +287,8 @@ dojo._hasResource["dojo.foo"] = true;
var syms = modulename.split(".");
for(var i = syms.length; i>0; i--){
var parentModule = syms.slice(0, i).join(".");
- if(i == 1 && !d._moduleHasPrefix(parentModule)){
- // Support default module directory (sibling of dojo) for top-level modules
+ if(i == 1 && !d._moduleHasPrefix(parentModule)){
+ // Support default module directory (sibling of dojo) for top-level modules
syms[0] = "../" + syms[0];
}else{
var parentModulePath = d._getModulePrefix(parentModule);
@@ -320,87 +323,95 @@ dojo._hasResource["dojo.foo"] = true;
dojo._loadModule = dojo.require = function(/*String*/moduleName, /*Boolean?*/omitModuleCheck){
// summary:
// loads a Javascript module from the appropriate URI
- // moduleName:
+ //
+ // moduleName: String
// module name to load, using periods for separators,
// e.g. "dojo.date.locale". Module paths are de-referenced by dojo's
// internal mapping of locations to names and are disambiguated by
// longest prefix. See `dojo.registerModulePath()` for details on
// registering new modules.
- // omitModuleCheck:
+ //
+ // omitModuleCheck: Boolean?
// if `true`, omitModuleCheck skips the step of ensuring that the
// loaded file actually defines the symbol it is referenced by.
// For example if it called as `dojo.require("a.b.c")` and the
// file located at `a/b/c.js` does not define an object `a.b.c`,
// and exception will be throws whereas no exception is raised
// when called as `dojo.require("a.b.c", true)`
+ //
// description:
// Modules are loaded via dojo.require by using one of two loaders: the normal loader
// and the xdomain loader. The xdomain loader is used when dojo was built with a
// custom build that specified loader=xdomain and the module lives on a modulePath
// that is a whole URL, with protocol and a domain. The versions of Dojo that are on
// the Google and AOL CDNs use the xdomain loader.
- //
+ //
// If the module is loaded via the xdomain loader, it is an asynchronous load, since
// the module is added via a dynamically created script tag. This
- // means that dojo.require() can return before the module has loaded. However, this
+ // means that dojo.require() can return before the module has loaded. However, this
// should only happen in the case where you do dojo.require calls in the top-level
// HTML page, or if you purposely avoid the loader checking for dojo.require
// dependencies in your module by using a syntax like dojo["require"] to load the module.
- //
+ //
// Sometimes it is useful to not have the loader detect the dojo.require calls in the
// module so that you can dynamically load the modules as a result of an action on the
// page, instead of right at module load time.
- //
+ //
// Also, for script blocks in an HTML page, the loader does not pre-process them, so
// it does not know to download the modules before the dojo.require calls occur.
- //
+ //
// So, in those two cases, when you want on-the-fly module loading or for script blocks
// in the HTML page, special care must be taken if the dojo.required code is loaded
// asynchronously. To make sure you can execute code that depends on the dojo.required
// modules, be sure to add the code that depends on the modules in a dojo.addOnLoad()
// callback. dojo.addOnLoad waits for all outstanding modules to finish loading before
- // executing. Example:
- //
- // | <script type="text/javascript">
- // | dojo.require("foo");
- // | dojo.require("bar");
- // | dojo.addOnLoad(function(){
- // | //you can now safely do something with foo and bar
- // | });
- // | </script>
- //
+ // executing.
+ //
// This type of syntax works with both xdomain and normal loaders, so it is good
// practice to always use this idiom for on-the-fly code loading and in HTML script
// blocks. If at some point you change loaders and where the code is loaded from,
// it will all still work.
- //
+ //
// More on how dojo.require
// `dojo.require("A.B")` first checks to see if symbol A.B is
// defined. If it is, it is simply returned (nothing to do).
- //
+ //
// If it is not defined, it will look for `A/B.js` in the script root
// directory.
- //
- // `dojo.require` throws an excpetion if it cannot find a file
+ //
+ // `dojo.require` throws an exception if it cannot find a file
// to load, or if the symbol `A.B` is not defined after loading.
- //
+ //
// It returns the object `A.B`, but note the caveats above about on-the-fly loading and
// HTML script blocks when the xdomain loader is loading a module.
- //
+ //
// `dojo.require()` does nothing about importing symbols into
// the current namespace. It is presumed that the caller will
- // take care of that. For example, to import all symbols into a
- // local block, you might write:
- //
+ // take care of that.
+ //
+ // example:
+ // To use dojo.require in conjunction with dojo.ready:
+ //
+ // | dojo.require("foo");
+ // | dojo.require("bar");
+ // | dojo.addOnLoad(function(){
+ // | //you can now safely do something with foo and bar
+ // | });
+ //
+ // example:
+ // For example, to import all symbols into a local block, you might write:
+ //
// | with (dojo.require("A.B")) {
// | ...
// | }
- //
+ //
// And to import just the leaf symbol to a local variable:
- //
+ //
// | var B = dojo.require("A.B");
// | ...
- // returns: the required namespace object
+ //
+ // returns:
+ // the required namespace object
omitModuleCheck = d._global_omit_module_check || omitModuleCheck;
//Check if it is already loaded.
@@ -411,10 +422,8 @@ dojo._hasResource["dojo.foo"] = true;
// convert periods to slashes
var relpath = d._getModuleSymbols(moduleName).join("/") + '.js';
-
var modArg = !omitModuleCheck ? moduleName : null;
var ok = d._loadPath(relpath, modArg);
-
if(!ok && !omitModuleCheck){
throw new Error("Could not load '" + moduleName + "'; last tried '" + relpath + "'");
}
@@ -425,7 +434,7 @@ dojo._hasResource["dojo.foo"] = true;
// pass in false so we can give better error
module = d._loadedModules[moduleName];
if(!module){
- throw new Error("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'");
+ throw new Error("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'");
}
}
@@ -446,14 +455,14 @@ dojo._hasResource["dojo.foo"] = true;
// the file name. For example, `js/dojo/foo.js` must have
// `dojo.provide("dojo.foo");` before any calls to
// `dojo.require()` are made.
- //
+ //
// For backwards compatibility reasons, in addition to registering
// the resource, `dojo.provide()` also ensures that the javascript
// object for the module exists. For example,
// `dojo.provide("dojox.data.FlickrStore")`, in addition to
// registering that `FlickrStore.js` is a resource for the
// `dojox.data` module, will ensure that the `dojox.data`
- // javascript object exists, so that calls like
+ // javascript object exists, so that calls like
// `dojo.data.foo = function(){ ... }` don't fail.
//
// In the case of a build where multiple javascript source files
@@ -462,11 +471,11 @@ dojo._hasResource["dojo.foo"] = true;
// note that it includes multiple resources.
//
// resourceName: String
- // A dot-sperated string identifying a resource.
+ // A dot-sperated string identifying a resource.
//
// example:
// Safely create a `my` object, and make dojo.require("my.CustomModule") work
- // | dojo.provide("my.CustomModule");
+ // | dojo.provide("my.CustomModule");
//Make sure we have a string.
resourceName = resourceName + "";
@@ -523,7 +532,7 @@ dojo._hasResource["dojo.foo"] = true;
if(condition === true){
// FIXME: why do we support chained require()'s here? does the build system?
var args = [];
- for(var i = 1; i < arguments.length; i++){
+ for(var i = 1; i < arguments.length; i++){
args.push(arguments[i]);
}
d.require.apply(d, args);
@@ -533,13 +542,13 @@ dojo._hasResource["dojo.foo"] = true;
dojo.requireAfterIf = d.requireIf;
dojo.registerModulePath = function(/*String*/module, /*String*/prefix){
- // summary:
+ // summary:
// Maps a module name to a path
- // description:
+ // description:
// An unregistered module is given the default path of ../[module],
// relative to Dojo root. For example, module acme is mapped to
// ../acme. If you want to use a different module name, use
- // dojo.registerModulePath.
+ // dojo.registerModulePath.
// example:
// If your dojo.js is located at this location in the web root:
// | /myapp/js/dojo/dojo/dojo.js
@@ -552,7 +561,7 @@ dojo._hasResource["dojo.foo"] = true;
// At which point you can then use dojo.require() to load the
// modules (assuming they provide() the same things which are
// required). The full code might be:
- // | <script type="text/javascript"
+ // | <script type="text/javascript"
// | src="/myapp/js/dojo/dojo/dojo.js"></script>
// | <script type="text/javascript">
// | dojo.registerModulePath("foo", "../../foo");
@@ -561,8 +570,8 @@ dojo._hasResource["dojo.foo"] = true;
// | dojo.require("foo.thud.xyzzy");
// | </script>
d._modulePrefixes[module] = { name: module, value: prefix };
- }
-
+ };
+
dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String?*/availableFlatLocales){
// summary:
// Declares translated resources and loads them if necessary, in the
@@ -573,7 +582,7 @@ dojo._hasResource["dojo.foo"] = true;
// description:
// Load translated resource bundles provided underneath the "nls"
// directory within a package. Translated resources may be located in
- // different packages throughout the source tree.
+ // different packages throughout the source tree.
//
// Each directory is named for a locale as specified by RFC 3066,
// (http://www.ietf.org/rfc/rfc3066.txt), normalized in lowercase.
@@ -588,21 +597,21 @@ dojo._hasResource["dojo.foo"] = true;
// preload the bundles to avoid data redundancy and the multiple
// network hits normally required to load these resources.
//
- // moduleName:
+ // moduleName:
// name of the package containing the "nls" directory in which the
// bundle is found
//
- // bundleName:
+ // bundleName:
// bundle name, i.e. the filename without the '.js' suffix. Using "nls" as a
// a bundle name is not supported, since "nls" is the name of the folder
// that holds bundles. Using "nls" as the bundle name will cause problems
// with the custom build.
//
- // locale:
+ // locale:
// the locale to load (optional) By default, the browser's user
// locale as defined by dojo.locale
//
- // availableFlatLocales:
+ // availableFlatLocales:
// A comma-separated list of the available, flattened locales for this
// bundle. This argument should only be set by the build process.
//
@@ -644,11 +653,11 @@ dojo._hasResource["dojo.foo"] = true;
ire = new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");
dojo._Url = function(/*dojo._Url|String...*/){
- // summary:
+ // summary:
// Constructor to create an object representing a URL.
// It is marked as private, since we might consider removing
// or simplifying it.
- // description:
+ // description:
// Each argument is evaluated in order relative to the next until
// a canonical uri is produced. To get an absolute Uri relative to
// the current document use:
@@ -715,7 +724,7 @@ dojo._hasResource["dojo.foo"] = true;
}
uri = [];
- if(relobj.scheme){
+ if(relobj.scheme){
uri.push(relobj.scheme, ":");
}
if(relobj.authority){
@@ -755,7 +764,7 @@ dojo._hasResource["dojo.foo"] = true;
dojo._Url.prototype.toString = function(){ return this.uri; };
dojo.moduleUrl = function(/*String*/module, /*dojo._Url||String*/url){
- // summary:
+ // summary:
// Returns a `dojo._Url` object relative to a module.
// example:
// | var pngPath = dojo.moduleUrl("acme","images/small.png");
@@ -763,10 +772,10 @@ dojo._hasResource["dojo.foo"] = true;
// | // create an image and set it's source to pngPath's value:
// | var img = document.createElement("img");
// | // NOTE: we assign the string representation of the url object
- // | img.src = pngPath.toString();
+ // | img.src = pngPath.toString();
// | // add our image to the document
// | dojo.body().appendChild(img);
- // example:
+ // example:
// you may de-reference as far as you like down the package
// hierarchy. This is sometimes handy to avoid lenghty relative
// urls or for building portable sub-packages. In this example,
@@ -777,9 +786,9 @@ dojo._hasResource["dojo.foo"] = true;
// | // somewhere in a configuration block
// | dojo.registerModulePath("acme.widget", "../../acme/widget");
// | dojo.registerModulePath("acme.util", "../../util");
- // |
+ // |
// | // ...
- // |
+ // |
// | // code in a module using acme resources
// | var tmpltPath = dojo.moduleUrl("acme.widget","templates/template.html");
// | var dataPath = dojo.moduleUrl("acme.util","resources/data.json");
@@ -798,7 +807,10 @@ dojo._hasResource["dojo.foo"] = true;
}
return new d._Url(loc, url); // dojo._Url
- }
+ };
+
+
+
})();
}
diff --git a/lib/dojo/_base/_loader/loader_debug.js b/lib/dojo/_base/_loader/loader_debug.js
index fa26d8efb..f2043e4de 100644
--- a/lib/dojo/_base/_loader/loader_debug.js
+++ b/lib/dojo/_base/_loader/loader_debug.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
diff --git a/lib/dojo/_base/_loader/loader_xd.js b/lib/dojo/_base/_loader/loader_xd.js
index c60b86b05..e59f814c0 100644
--- a/lib/dojo/_base/_loader/loader_xd.js
+++ b/lib/dojo/_base/_loader/loader_xd.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -170,23 +170,27 @@ dojo._xdIsXDomainPath = function(/*string*/relpath) {
var colonIndex = relpath.indexOf(":");
var slashIndex = relpath.indexOf("/");
- if(colonIndex > 0 && colonIndex < slashIndex){
+ if(colonIndex > 0 && colonIndex < slashIndex || relpath.indexOf("//") === 0){
return true;
}else{
//Is the base script URI-based URL a cross domain URL?
//If so, then the relpath will be evaluated relative to
//baseUrl, and therefore qualify as xdomain.
//Only treat it as xdomain if the page does not have a
- //host (file:// url) or if the baseUrl does not match the
- //current window's domain.
+ //host (file:// url), if the baseUrl does not match the
+ //current window's domain, or if the baseUrl starts with //.
+ //If baseUrl starts with // then it probably means that xdomain
+ //is wanted since it is such a specific path request. This is not completely robust,
+ //but something more robust would require normalizing the protocol on baseUrl and on the location
+ //to see if they differ. However, that requires more code, and // as a start path is unusual.
var url = dojo.baseUrl;
colonIndex = url.indexOf(":");
slashIndex = url.indexOf("/");
- if(colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0)){
+ if(url.indexOf("//") === 0 || (colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0))){
return true;
}
}
- return false;
+ return false;
}
dojo._loadPath = function(/*String*/relpath, /*String?*/module, /*Function?*/cb){
@@ -218,8 +222,8 @@ dojo._loadUri = function(/*String*/uri, /*Function?*/cb, /*boolean*/currentIsXDo
}
//Add the module (resource) to the list of modules.
- //Only do this work if we have a modlue name. Otherwise,
- //it is a non-xd i18n bundle, which can load immediately and does not
+ //Only do this work if we have a modlue name. Otherwise,
+ //it is a non-xd i18n bundle, which can load immediately and does not
//need to be tracked. Also, don't track dojo.i18n, since it is a prerequisite
//and will be loaded correctly if we load it right away: it has no dependencies.
if(dojo._isXDomain && module && module != "dojo.i18n"){
@@ -386,7 +390,7 @@ dojo._xdResourceLoaded = function(/*Object*/res){
}
//Now update the inflight status for any provided resources in this loaded resource.
- //Do this at the very end (in a *separate* for loop) to avoid shutting down the
+ //Do this at the very end (in a *separate* for loop) to avoid shutting down the
//inflight timer check too soon.
for(i = 0; i < provideList.length; i++){
dojo._xdInFlight[provideList[i]] = false;
@@ -490,7 +494,7 @@ dojo.xdRequireLocalization = function(/*String*/moduleName, /*String*/bundleName
// Replace dojo.requireLocalization with a wrapper
dojo._xdRealRequireLocalization = dojo.requireLocalization;
dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String*/availableFlatLocales){
- // summary: loads a bundle intelligently based on whether the module is
+ // summary: loads a bundle intelligently based on whether the module is
// local or xd. Overrides the local-case implementation.
var modulePath = dojo.moduleUrl(moduleName).toString();
@@ -525,7 +529,7 @@ dojo._xdUnpackDependency = function(/*Array*/dep){
case "platformRequire":
var modMap = dep[1];
var common = modMap["common"]||[];
- newDeps = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
+ newDeps = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
//Flatten the array of arrays into a one-level deep array.
//Each result could be an array of 3 elements (the 3 arguments to dojo.require).
//We only need the first one.
@@ -562,7 +566,7 @@ dojo._xdUnpackDependency = function(/*Array*/dep){
}
dojo._xdWalkReqs = function(){
- //summary: Internal xd loader function.
+ //summary: Internal xd loader function.
//Walks the requires and evaluates module resource contents in
//the right order.
var reqChain = null;
@@ -578,7 +582,7 @@ dojo._xdWalkReqs = function(){
}
dojo._xdEvalReqs = function(/*Array*/reqChain){
- //summary: Internal xd loader function.
+ //summary: Internal xd loader function.
//Does a depth first, breadth second search and eval of required modules.
while(reqChain.length > 0){
var req = reqChain[reqChain.length - 1];
@@ -673,7 +677,7 @@ dojo._xdWatchInFlight = function(){
dojo._xdDebugQueue.push({resourceName: content.resourceName, resourcePath: content.resourcePath});
}else{
//Evaluate the resource to bring it into being.
- //Pass in scope args to allow multiple versions of modules in a page.
+ //Pass in scope args to allow multiple versions of modules in a page.
content.apply(dojo.global, dojo._scopeArgs);
}
}
@@ -685,7 +689,7 @@ dojo._xdWatchInFlight = function(){
for(i = 0; i < dojo._xdContents.length; i++){
var current = dojo._xdContents[i];
if(current.content && !current.isDefined){
- //Pass in scope args to allow multiple versions of modules in a page.
+ //Pass in scope args to allow multiple versions of modules in a page.
current.content.apply(dojo.global, dojo._scopeArgs);
}
}
@@ -712,10 +716,10 @@ dojo._xdNotifyLoaded = function(){
}
}
- dojo._inFlightCount = 0;
+ dojo._inFlightCount = 0;
- //Only trigger call loaded if dj_load_init has run.
- if(dojo._initFired && !dojo._loadNotifying){
+ //Only trigger call loaded if dj_load_init has run.
+ if(dojo._initFired && !dojo._loadNotifying){
dojo._callLoaded();
}
}
diff --git a/lib/dojo/_base/array.js b/lib/dojo/_base/array.js
index 26fa1900d..57cea4229 100644
--- a/lib/dojo/_base/array.js
+++ b/lib/dojo/_base/array.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -7,13 +7,14 @@
if(!dojo._hasResource["dojo._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.array"] = true;
-dojo.require("dojo._base.lang");
dojo.provide("dojo._base.array");
+dojo.require("dojo._base.lang");
+
(function(){
var _getParts = function(arr, obj, cb){
- return [
- (typeof arr == "string") ? arr.split("") : arr,
+ return [
+ (typeof arr == "string") ? arr.split("") : arr,
obj || dojo.global,
// FIXME: cache the anonymous functions we create here?
(typeof cb == "string") ? new Function("item", "index", "array", cb) : cb
@@ -32,7 +33,7 @@ dojo.provide("dojo._base.array");
};
dojo.mixin(dojo, {
- indexOf: function( /*Array*/ array,
+ indexOf: function( /*Array*/ array,
/*Object*/ value,
/*Integer?*/ fromIndex,
/*Boolean?*/ findLast){
@@ -41,7 +42,7 @@ dojo.provide("dojo._base.array");
// passed array. If the value is not found, -1 is returned.
// description:
// This method corresponds to the JavaScript 1.6 Array.indexOf method, with one difference: when
- // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
+ // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
// 1.6's indexOf skips the holes in the sparse array.
// For details on this method, see:
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf
@@ -66,7 +67,7 @@ dojo.provide("dojo._base.array");
// array. If the value is not found, -1 is returned.
// description:
// This method corresponds to the JavaScript 1.6 Array.lastIndexOf method, with one difference: when
- // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
+ // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
// 1.6's lastIndexOf skips the holes in the sparse array.
// For details on this method, see:
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/lastIndexOf
@@ -85,7 +86,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's forEach skips the holes in the sparse array.
// For more details, see:
@@ -108,21 +109,21 @@ dojo.provide("dojo._base.array");
// | );
// example:
// | // use a scoped object member as the callback
- // |
+ // |
// | var obj = {
- // | prefix: "logged via obj.callback:",
+ // | prefix: "logged via obj.callback:",
// | callback: function(item){
// | console.log(this.prefix, item);
// | }
// | };
- // |
+ // |
// | // specifying the scope function executes the callback in that scope
// | dojo.forEach(
// | [ "thinger", "blah", "howdy", 10 ],
// | obj.callback,
// | obj
// | );
- // |
+ // |
// | // alternately, we can accomplish the same thing with dojo.hitch()
// | dojo.forEach(
// | [ "thinger", "blah", "howdy", 10 ],
@@ -135,7 +136,7 @@ dojo.provide("dojo._base.array");
// FIXME: there are several ways of handilng thisObject. Is
// dojo.global always the default context?
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
- for(var i=0,l=arr.length; i<l; ++i){
+ for(var i=0,l=arr.length; i<l; ++i){
_p[2].call(_p[1], arr[i], i, arr);
}
},
@@ -152,7 +153,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's every skips the holes in the sparse array.
// For more details, see:
@@ -161,7 +162,7 @@ dojo.provide("dojo._base.array");
// | // returns false
// | dojo.every([1, 2, 3, 4], function(item){ return item>1; });
// example:
- // | // returns true
+ // | // returns true
// | dojo.every([1, 2, 3, 4], function(item){ return item>0; });
return everyOrSome(true, arr, callback, thisObject); // Boolean
},
@@ -178,7 +179,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's some skips the holes in the sparse array.
// For more details, see:
@@ -205,7 +206,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's map skips the holes in the sparse array.
// For more details, see:
@@ -236,9 +237,9 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
- // the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
+ // the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
// For more details, see:
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
// example:
diff --git a/lib/dojo/_base/browser.js b/lib/dojo/_base/browser.js
index 496fe46b3..209330f0d 100644
--- a/lib/dojo/_base/browser.js
+++ b/lib/dojo/_base/browser.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -8,7 +8,6 @@
if(!dojo._hasResource["dojo._base.browser"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.browser"] = true;
dojo.provide("dojo._base.browser");
-
dojo.require("dojo._base.window");
dojo.require("dojo._base.connect");
dojo.require("dojo._base.event");
@@ -18,12 +17,12 @@ dojo.require("dojo._base.query");
dojo.require("dojo._base.xhr");
dojo.require("dojo._base.fx");
-//Need this to be the last code segment in base, so do not place any
-//dojo.requireIf calls in this file. Otherwise, due to how the build system
-//puts all requireIf dependencies after the current file, the require calls
-//could be called before all of base is defined.
-dojo.forEach(dojo.config.require, function(i){
- dojo["require"](i);
-});
+ //Need this to be the last code segment in base, so do not place any
+ //dojo/requireIf calls in this file/ Otherwise, due to how the build system
+ //puts all requireIf dependencies after the current file, the require calls
+ //could be called before all of base is defined/
+ dojo.forEach(dojo.config.require, function(i){
+ dojo["require"](i);
+ });
}
diff --git a/lib/dojo/_base/connect.js b/lib/dojo/_base/connect.js
index f37af65b2..7e8006221 100644
--- a/lib/dojo/_base/connect.js
+++ b/lib/dojo/_base/connect.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,27 +10,28 @@ dojo._hasResource["dojo._base.connect"] = true;
dojo.provide("dojo._base.connect");
dojo.require("dojo._base.lang");
+
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
// low-level delegation machinery
dojo._listener = {
// create a dispatcher function
getDispatcher: function(){
- // following comments pulled out-of-line to prevent cloning them
+ // following comments pulled out-of-line to prevent cloning them
// in the returned function.
- // - indices (i) that are really in the array of listeners (ls) will
+ // - indices (i) that are really in the array of listeners (ls) will
// not be in Array.prototype. This is the 'sparse array' trick
- // that keeps us safe from libs that take liberties with built-in
+ // that keeps us safe from libs that take liberties with built-in
// objects
// - listener is invoked with current scope (this)
return function(){
- var ap=Array.prototype, c=arguments.callee, ls=c._listeners, t=c.target;
+ var ap = Array.prototype, c = arguments.callee, ls = c._listeners, t = c.target,
// return value comes from original target function
- var r = t && t.apply(this, arguments);
+ r = t && t.apply(this, arguments),
// make local copy of listener array so it is immutable during processing
- var i, lls;
- lls = [].concat(ls);
-
+ i, lls = [].concat(ls)
+ ;
+
// invoke listeners after target function
for(i in lls){
if(!(i in ap)){
@@ -44,12 +45,12 @@ dojo._listener = {
// add a listener to an object
add: function(/*Object*/ source, /*String*/ method, /*Function*/ listener){
// Whenever 'method' is invoked, 'listener' will have the same scope.
- // Trying to supporting a context object for the listener led to
- // complexity.
+ // Trying to supporting a context object for the listener led to
+ // complexity.
// Non trivial to provide 'once' functionality here
// because listener could be the result of a dojo.hitch call,
// in which case two references to the same hitch target would not
- // be equivalent.
+ // be equivalent.
source = source || dojo.global;
// The source method is either null, a dispatcher, or some other function
var f = source[method];
@@ -59,15 +60,15 @@ dojo._listener = {
// original target function is special
d.target = f;
// dispatcher holds a list of listeners
- d._listeners = [];
+ d._listeners = [];
// redirect source to dispatcher
f = source[method] = d;
}
- // The contract is that a handle is returned that can
- // identify this listener for disconnect.
+ // The contract is that a handle is returned that can
+ // identify this listener for disconnect.
//
- // The type of the handle is private. Here is it implemented as Integer.
- // DOM event code has this same contract but handle is Function
+ // The type of the handle is private. Here is it implemented as Integer.
+ // DOM event code has this same contract but handle is Function
// in non-IE browsers.
//
// We could have separate lists of before and after listeners.
@@ -89,9 +90,9 @@ dojo._listener = {
// and dontFix argument here to help the autodocs. Actual DOM aware code is in
// event.js.
-dojo.connect = function(/*Object|null*/ obj,
- /*String*/ event,
- /*Object|null*/ context,
+dojo.connect = function(/*Object|null*/ obj,
+ /*String*/ event,
+ /*Object|null*/ context,
/*String|Function*/ method,
/*Boolean?*/ dontFix){
// summary:
@@ -126,37 +127,37 @@ dojo.connect = function(/*Object|null*/ obj,
// arguments may simply be omitted such that fewer than 4 arguments
// may be required to set up a connection See the examples for details.
//
- // The return value is a handle that is needed to
+ // The return value is a handle that is needed to
// remove this connection with `dojo.disconnect`.
//
- // obj:
- // The source object for the event function.
+ // obj:
+ // The source object for the event function.
// Defaults to `dojo.global` if null.
- // If obj is a DOM node, the connection is delegated
+ // If obj is a DOM node, the connection is delegated
// to the DOM event manager (unless dontFix is true).
//
// event:
- // String name of the event function in obj.
+ // String name of the event function in obj.
// I.e. identifies a property `obj[event]`.
//
- // context:
+ // context:
// The object that method will receive as "this".
//
// If context is null and method is a function, then method
// inherits the context of event.
- //
- // If method is a string then context must be the source
+ //
+ // If method is a string then context must be the source
// object object for method (context[method]). If context is null,
// dojo.global is used.
//
// method:
- // A function reference, or name of a function in context.
- // The function identified by method fires after event does.
+ // A function reference, or name of a function in context.
+ // The function identified by method fires after event does.
// method receives the same arguments as the event.
// See context argument comments for information on method's scope.
//
// dontFix:
- // If obj is a DOM node, set dontFix to true to prevent delegation
+ // If obj is a DOM node, set dontFix to true to prevent delegation
// of this connection to the DOM event manager.
//
// example:
@@ -206,9 +207,9 @@ dojo.connect = function(/*Object|null*/ obj,
// used by non-browser hostenvs. always overriden by event.js
dojo._connect = function(obj, event, context, method){
- var l=dojo._listener, h=l.add(obj, event, dojo.hitch(context, method));
+ var l=dojo._listener, h=l.add(obj, event, dojo.hitch(context, method));
return [obj, event, h, l]; // Handle
-}
+};
dojo.disconnect = function(/*Handle*/ handle){
// summary:
@@ -222,11 +223,11 @@ dojo.disconnect = function(/*Handle*/ handle){
// let's not keep this reference
delete handle[0];
}
-}
+};
dojo._disconnect = function(obj, event, handle, listener){
listener.remove(obj, event, handle);
-}
+};
// topic publish/subscribe
@@ -244,15 +245,15 @@ dojo.subscribe = function(/*String*/ topic, /*Object|null*/ context, /*String|Fu
// is invoked when topic is published.
// example:
// | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); });
- // | dojo.publish("alerts", [ "read this", "hello world" ]);
+ // | dojo.publish("alerts", [ "read this", "hello world" ]);
// support for 2 argument invocation (omitting context) depends on hitch
return [topic, dojo._listener.add(dojo._topics, topic, dojo.hitch(context, method))]; /*Handle*/
-}
+};
dojo.unsubscribe = function(/*Handle*/ handle){
// summary:
- // Remove a topic listener.
+ // Remove a topic listener.
// handle:
// The handle returned from a call to subscribe.
// example:
@@ -262,7 +263,7 @@ dojo.unsubscribe = function(/*Handle*/ handle){
if(handle){
dojo._listener.remove(dojo._topics, handle[0], handle[1]);
}
-}
+};
dojo.publish = function(/*String*/ topic, /*Array*/ args){
// summary:
@@ -270,11 +271,11 @@ dojo.publish = function(/*String*/ topic, /*Array*/ args){
// topic:
// The name of the topic to publish.
// args:
- // An array of arguments. The arguments will be applied
+ // An array of arguments. The arguments will be applied
// to each topic subscriber (as first class parameters, via apply).
// example:
// | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
- // | dojo.publish("alerts", [ "read this", "hello world" ]);
+ // | 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
@@ -283,10 +284,10 @@ dojo.publish = function(/*String*/ topic, /*Array*/ args){
if(f){
f.apply(this, args||[]);
}
-}
+};
-dojo.connectPublisher = function( /*String*/ topic,
- /*Object|null*/ obj,
+dojo.connectPublisher = function( /*String*/ topic,
+ /*Object|null*/ obj,
/*String*/ event){
// summary:
// Ensure that every time obj.event() is called, a message is published
@@ -295,11 +296,11 @@ dojo.connectPublisher = function( /*String*/ topic,
// the topic.
// topic:
// The name of the topic to publish.
- // obj:
+ // obj:
// The source object for the event function. Defaults to dojo.global
// if null.
// event:
- // The name of the event function in obj.
+ // The name of the event function in obj.
// I.e. identifies a property obj[event].
// example:
// | dojo.connectPublisher("/ajax/start", dojo, "xhrGet");
diff --git a/lib/dojo/_base/declare.js b/lib/dojo/_base/declare.js
index 8e46b12c0..437914870 100644
--- a/lib/dojo/_base/declare.js
+++ b/lib/dojo/_base/declare.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -8,18 +8,18 @@
if(!dojo._hasResource["dojo._base.declare"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.declare"] = true;
dojo.provide("dojo._base.declare");
-
dojo.require("dojo._base.lang");
dojo.require("dojo._base.array");
+
(function(){
var d = dojo, mix = d._mixin, op = Object.prototype, opts = op.toString,
xtor = new Function, counter = 0, cname = "constructor";
- function err(msg){ throw new Error("declare: " + msg); }
+ function err(msg, cls){ throw new Error("declare" + (cls ? " " + cls : "") + ": " + msg); }
// C3 Method Resolution Order (see http://www.python.org/download/releases/2.3/mro/)
- function c3mro(bases){
+ function c3mro(bases, className){
var result = [], roots = [{cls: 0, refs: []}], nameMap = {}, clsCount = 1,
l = bases.length, i = 0, j, lin, base, top, proto, rec, name, refs;
@@ -27,9 +27,9 @@ dojo.require("dojo._base.array");
for(; i < l; ++i){
base = bases[i];
if(!base){
- err("mixin #" + i + " is unknown. Did you use dojo.require to pull it in?");
+ err("mixin #" + i + " is unknown. Did you use dojo.require to pull it in?", className);
}else if(opts.call(base) != "[object Function]"){
- err("mixin #" + i + " is not a callable constructor.");
+ err("mixin #" + i + " is not a callable constructor.", className);
}
lin = base._meta ? base._meta.bases : [base];
top = 0;
@@ -82,7 +82,7 @@ dojo.require("dojo._base.array");
}
}
if(clsCount){
- err("can't build consistent linearization");
+ err("can't build consistent linearization", className);
}
// calculate the superclass offset
@@ -109,7 +109,7 @@ dojo.require("dojo._base.array");
caller = args.callee;
name = name || caller.nom;
if(!name){
- err("can't deduce a name to call inherited()");
+ err("can't deduce a name to call inherited()", this.declaredClass);
}
meta = this.constructor._meta;
@@ -127,7 +127,7 @@ dojo.require("dojo._base.array");
// error detection
chains = meta.chains;
if(chains && typeof chains[name] == "string"){
- err("calling chained method with inherited: " + name);
+ err("calling chained method with inherited: " + name, this.declaredClass);
}
// find caller
do{
@@ -168,7 +168,7 @@ dojo.require("dojo._base.array");
// error detection
chains = meta.chains;
if(!chains || chains.constructor !== "manual"){
- err("calling chained constructor with inherited");
+ err("calling chained constructor with inherited", this.declaredClass);
}
// find caller
while(base = bases[++pos]){ // intentional assignment
@@ -464,7 +464,7 @@ dojo.require("dojo._base.array");
// build a prototype
if(opts.call(superclass) == "[object Array]"){
// C3 MRO
- bases = c3mro(superclass);
+ bases = c3mro(superclass, className);
t = bases[0];
mixins = bases.length - t;
superclass = bases[mixins];
@@ -475,10 +475,10 @@ dojo.require("dojo._base.array");
t = superclass._meta;
bases = bases.concat(t ? t.bases : superclass);
}else{
- err("base class is not a callable constructor.");
+ err("base class is not a callable constructor.", className);
}
}else if(superclass !== null){
- err("unknown base class. Did you use dojo.require to pull it in?")
+ err("unknown base class. Did you use dojo.require to pull it in?", className);
}
}
if(superclass){
diff --git a/lib/dojo/_base/event.js b/lib/dojo/_base/event.js
index 5268c6cff..65239bf50 100644
--- a/lib/dojo/_base/event.js
+++ b/lib/dojo/_base/event.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,27 +10,26 @@ dojo._hasResource["dojo._base.event"] = true;
dojo.provide("dojo._base.event");
dojo.require("dojo._base.connect");
+
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
(function(){
// DOM event listener machinery
var del = (dojo._event_listener = {
add: function(/*DOMNode*/ node, /*String*/ name, /*Function*/ fp){
- if(!node){return;}
+ if(!node){return;}
name = del._normalizeEventName(name);
fp = del._fixCallback(name, fp);
- var oname = name;
if(
- !dojo.isIE &&
+ !dojo.isIE &&
(name == "mouseenter" || name == "mouseleave")
){
var ofp = fp;
- //oname = name;
name = (name == "mouseenter") ? "mouseover" : "mouseout";
fp = function(e){
if(!dojo.isDescendant(e.relatedTarget, node)){
// e.type = oname; // FIXME: doesn't take? SJM: event.type is generally immutable.
- return ofp.call(this, e);
+ return ofp.call(this, e);
}
}
}
@@ -71,7 +70,7 @@ dojo.require("dojo._base.connect");
},
_fixEvent: function(evt, sender){
// _fixCallback only attaches us to keypress.
- // Switch on evt.type anyway because we might
+ // Switch on evt.type anyway because we might
// be called directly from dojo.fixEvent.
switch(evt.type){
case "keypress":
@@ -81,26 +80,26 @@ dojo.require("dojo._base.connect");
return evt;
},
_setKeyChar: function(evt){
- evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
+ evt.keyChar = evt.charCode >= 32 ? String.fromCharCode(evt.charCode) : '';
evt.charOrCode = evt.keyChar || evt.keyCode;
},
// For IE and Safari: some ctrl-key combinations (mostly w/punctuation) do not emit a char code in IE
// we map those virtual key codes to ascii here
// not valid for all (non-US) keyboards, so maybe we shouldn't bother
- _punctMap: {
- 106:42,
- 111:47,
- 186:59,
- 187:43,
- 188:44,
- 189:45,
- 190:46,
- 191:47,
- 192:96,
- 219:91,
- 220:92,
- 221:93,
- 222:39
+ _punctMap: {
+ 106:42,
+ 111:47,
+ 186:59,
+ 187:43,
+ 188:44,
+ 189:45,
+ 190:46,
+ 191:47,
+ 192:96,
+ 219:91,
+ 220:92,
+ 221:93,
+ 222:39
}
});
@@ -115,7 +114,7 @@ dojo.require("dojo._base.connect");
// sender: DOMNode
// node to treat as "currentTarget"
return del._fixEvent(evt, sender);
- }
+ };
dojo.stopEvent = function(/*Event*/ evt){
// summary:
@@ -126,7 +125,7 @@ dojo.require("dojo._base.connect");
evt.preventDefault();
evt.stopPropagation();
// NOTE: below, this method is overridden for IE
- }
+ };
// the default listener to use on dontFix nodes, overriden for IE
var node_listener = dojo._listener;
@@ -141,16 +140,16 @@ dojo.require("dojo._base.connect");
// create a listener
var h = l.add(obj, event, dojo.hitch(context, method));
// formerly, the disconnect package contained "l" directly, but if client code
- // leaks the disconnect package (by connecting it to a node), referencing "l"
+ // leaks the disconnect package (by connecting it to a node), referencing "l"
// compounds the problem.
// instead we return a listener id, which requires custom _disconnect below.
// return disconnect package
return [ obj, event, h, lid ];
- }
+ };
dojo._disconnect = function(obj, event, handle, listener){
([dojo._listener, del, node_listener][listener]).remove(obj, event, handle);
- }
+ };
// Constants
@@ -280,7 +279,7 @@ dojo.require("dojo._base.connect");
};
=====*/
- if(dojo.isIE){
+ if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
dojo.mouseButtons = {
LEFT: 1,
MIDDLE: 4,
@@ -305,7 +304,7 @@ dojo.require("dojo._base.connect");
}
// IE event normalization
- if(dojo.isIE){
+ if(dojo.isIE){
var _trySetKeyCode = function(e, code){
try{
// squelch errors when keyCode is read-only
@@ -314,7 +313,7 @@ dojo.require("dojo._base.connect");
}catch(e){
return 0;
}
- }
+ };
// by default, use the standard listener
var iel = dojo._listener;
@@ -323,7 +322,7 @@ dojo.require("dojo._base.connect");
if(!dojo.config._allow_leaks){
// custom listener that handles leak protection for DOM events
node_listener = iel = dojo._ie_listener = {
- // support handler indirection: event handler functions are
+ // support handler indirection: event handler functions are
// referenced here. Event dispatchers hold only indices.
handlers: [],
// add a listener to an object
@@ -376,7 +375,7 @@ dojo.require("dojo._base.connect");
},
remove: function(/*DOMNode*/ node, /*String*/ event, /*Handle*/ handle){
event = del._normalizeEventName(event);
- iel.remove(node, event, handle);
+ iel.remove(node, event, handle);
if(event=="onkeypress"){
var kd = node.onkeydown;
if(--kd._stealthKeydownRefs <= 0){
@@ -402,11 +401,11 @@ dojo.require("dojo._base.connect");
// node to treat as "currentTarget"
if(!evt){
var w = sender && (sender.ownerDocument || sender.document || sender).parentWindow || window;
- evt = w.event;
+ evt = w.event;
}
if(!evt){return(evt);}
- evt.target = evt.srcElement;
- evt.currentTarget = (sender || evt.srcElement);
+ evt.target = evt.srcElement;
+ evt.currentTarget = (sender || evt.srcElement);
evt.layerX = evt.offsetX;
evt.layerY = evt.offsetY;
// FIXME: scroll position query is duped from dojo.html to
@@ -419,14 +418,16 @@ dojo.require("dojo._base.connect");
var offset = dojo._getIeDocumentElementOffset();
evt.pageX = evt.clientX + dojo._fixIeBiDiScrollLeft(docBody.scrollLeft || 0) - offset.x;
evt.pageY = evt.clientY + (docBody.scrollTop || 0) - offset.y;
- if(evt.type == "mouseover"){
+ if(evt.type == "mouseover"){
evt.relatedTarget = evt.fromElement;
}
- if(evt.type == "mouseout"){
+ if(evt.type == "mouseout"){
evt.relatedTarget = evt.toElement;
}
- evt.stopPropagation = del._stopPropagation;
- evt.preventDefault = del._preventDefault;
+ if (dojo.isIE < 9 || dojo.isQuirks) {
+ evt.stopPropagation = del._stopPropagation;
+ evt.preventDefault = del._preventDefault;
+ }
return del._fixKeys(evt);
},
_fixKeys: function(evt){
@@ -460,38 +461,41 @@ dojo.require("dojo._base.connect");
var k=evt.keyCode;
// These are Windows Virtual Key Codes
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
- var unprintable = k!=13 && k!=32 && k!=27 && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222);
+ var unprintable = (k!=13 || (dojo.isIE >= 9 && !dojo.isQuirks)) && k!=32 && k!=27 && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222);
+
// synthesize keypress for most unprintables and CTRL-keys
if(unprintable||evt.ctrlKey){
var c = unprintable ? 0 : k;
if(evt.ctrlKey){
if(k==3 || k==13){
- return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
- }else if(c>95 && c<106){
+ return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
+ }else if(c>95 && c<106){
c -= 48; // map CTRL-[numpad 0-9] to ASCII
- }else if((!evt.shiftKey)&&(c>=65&&c<=90)){
+ }else if((!evt.shiftKey)&&(c>=65&&c<=90)){
c += 32; // map CTRL-[A-Z] to lowercase
- }else{
+ }else{
c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
}
}
// simulate a keypress event
var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
kp.call(evt.currentTarget, faux);
- evt.cancelBubble = faux.cancelBubble;
+ if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
+ evt.cancelBubble = faux.cancelBubble;
+ }
evt.returnValue = faux.returnValue;
_trySetKeyCode(evt, faux.keyCode);
}
},
// Called in Event scope
_stopPropagation: function(){
- this.cancelBubble = true;
+ this.cancelBubble = true;
},
_preventDefault: function(){
// Setting keyCode to 0 is the only way to prevent certain keypresses (namely
// ctrl-combinations that correspond to menu accelerator keys).
// Otoh, it prevents upstream listeners from getting this information
- // Try to split the difference here by clobbering keyCode only for ctrl
+ // Try to split the difference here by clobbering keyCode only for ctrl
// combinations. If you still need to access the key upstream, bubbledKeyCode is
// provided as a workaround.
this.bubbledKeyCode = this.keyCode;
@@ -501,23 +505,23 @@ dojo.require("dojo._base.connect");
});
// override stopEvent for IE
- dojo.stopEvent = function(evt){
+ dojo.stopEvent = (dojo.isIE < 9 || dojo.isQuirks) ? function(evt){
evt = evt || window.event;
del._stopPropagation.call(evt);
del._preventDefault.call(evt);
- }
+ } : dojo.stopEvent;
}
del._synthesizeEvent = function(evt, props){
var faux = dojo.mixin({}, evt, props);
del._setKeyChar(faux);
- // FIXME: would prefer to use dojo.hitch: dojo.hitch(evt, evt.preventDefault);
+ // FIXME: would prefer to use dojo.hitch: dojo.hitch(evt, evt.preventDefault);
// but it throws an error when preventDefault is invoked on Safari
// does Event.preventDefault not support "apply" on Safari?
- faux.preventDefault = function(){ evt.preventDefault(); };
- faux.stopPropagation = function(){ evt.stopPropagation(); };
+ faux.preventDefault = function(){ evt.preventDefault(); };
+ faux.stopPropagation = function(){ evt.stopPropagation(); };
return faux;
- }
+ };
// Opera event normalization
if(dojo.isOpera){
@@ -568,12 +572,12 @@ dojo.require("dojo._base.connect");
var c = unprintable ? 0 : k;
if(evt.ctrlKey){
if(k==3 || k==13){
- return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
- }else if(c>95 && c<106){
+ return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
+ }else if(c>95 && c<106){
c -= 48; // map CTRL-[numpad 0-9] to ASCII
- }else if(!evt.shiftKey && c>=65 && c<=90){
+ }else if(!evt.shiftKey && c>=65 && c<=90){
c += 32; // map CTRL-[A-Z] to lowercase
- }else{
+ }else{
c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
}
}
@@ -630,16 +634,16 @@ if(dojo.isIE){
}
}
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)); };
- }
+ };
}
}
diff --git a/lib/dojo/_base/fx.js b/lib/dojo/_base/fx.js
index 21243c1c9..860e0e18b 100644
--- a/lib/dojo/_base/fx.js
+++ b/lib/dojo/_base/fx.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -13,6 +13,7 @@ dojo.require("dojo._base.connect");
dojo.require("dojo._base.lang");
dojo.require("dojo._base.html");
+
/*
Animation loosely package based on Dan Pupius' work, contributed under CLA:
http://pupius.co.uk/js/Toolkit.Drawing.js
diff --git a/lib/dojo/_base/html.js b/lib/dojo/_base/html.js
index be5fd2aaa..8661b2b12 100644
--- a/lib/dojo/_base/html.js
+++ b/lib/dojo/_base/html.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -7,8 +7,9 @@
if(!dojo._hasResource["dojo._base.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.html"] = true;
-dojo.require("dojo._base.lang");
dojo.provide("dojo._base.html");
+dojo.require("dojo._base.lang");
+
// FIXME: need to add unit tests for all the semi-public methods
@@ -53,13 +54,13 @@ dojo.byId = function(id, doc){
// | }
=====*/
-if(dojo.isIE || dojo.isOpera){
+if(dojo.isIE){
dojo.byId = function(id, doc){
if(typeof id != "string"){
return id;
}
var _d = doc || dojo.doc, te = _d.getElementById(id);
- // attributes.id.value is better than just id in case the
+ // attributes.id.value is better than just id in case the
// user has a name=id inside a form
if(te && (te.attributes.id.value == id || te.id == id)){
return te;
@@ -80,8 +81,9 @@ if(dojo.isIE || dojo.isOpera){
};
}else{
dojo.byId = function(id, doc){
- // inline'd type check
- return (typeof id == "string") ? (doc || dojo.doc).getElementById(id) : id; // DomNode
+ // inline'd type check.
+ // be sure to return null per documentation, to match IE branch.
+ return ((typeof id == "string") ? (doc || dojo.doc).getElementById(id) : id) || null; // DomNode
};
}
/*=====
@@ -164,16 +166,16 @@ if(dojo.isIE || dojo.isOpera){
};
dojo.setSelectable = function(/*DomNode|String*/node, /*Boolean*/selectable){
- // summary:
+ // summary:
// Enable or disable selection on a node
// node:
// id or reference to node
// selectable:
- // state to put the node in. false indicates unselectable, true
+ // state to put the node in. false indicates unselectable, true
// allows selection.
// example:
// Make the node id="bar" unselectable
- // | dojo.setSelectable("bar");
+ // | dojo.setSelectable("bar");
// example:
// Make the node id="bar" selectable
// | dojo.setSelectable("bar", true);
@@ -256,7 +258,7 @@ if(dojo.isIE || dojo.isOpera){
refNode = byId(refNode);
if(typeof node == "string"){ // inline'd type check
- node = node.charAt(0) == "<" ? d._toDom(node, refNode.ownerDocument) : byId(node);
+ node = /^\s*</.test(node) ? d._toDom(node, refNode.ownerDocument) : byId(node);
}
if(typeof position == "number"){ // inline'd type check
var cn = refNode.childNodes;
@@ -291,7 +293,7 @@ if(dojo.isIE || dojo.isOpera){
}
}
return node; // DomNode
- }
+ };
// Box functions will assume this model.
// On IE/Opera, BORDER_BOX will be set if the primary document is in quirks mode.
@@ -303,7 +305,7 @@ if(dojo.isIE || dojo.isOpera){
dojo.boxModel = "content-box";
// We punt per-node box mode testing completely.
- // If anybody cares, we can provide an additional (optional) unit
+ // If anybody cares, we can provide an additional (optional) unit
// that overrides existing code to include per-node box sensitivity.
// Opera documentation claims that Opera 9 uses border-box in BackCompat mode.
@@ -323,10 +325,10 @@ if(dojo.isIE || dojo.isOpera){
// getComputedStyle drives most of the style code.
// Wherever possible, reuse the returned object.
//
- // API functions below that need to access computed styles accept an
+ // API functions below that need to access computed styles accept an
// optional computedStyle parameter.
// If this parameter is omitted, the functions will call getComputedStyle themselves.
- // This way, calling code can access computedStyle once, and then pass the reference to
+ // This way, calling code can access computedStyle once, and then pass the reference to
// multiple API functions.
/*=====
@@ -365,7 +367,7 @@ if(dojo.isIE || dojo.isOpera){
// Although we normally eschew argument validation at this
// level, here we test argument 'node' for (duck)type,
// by testing nodeType, ecause 'document' is the 'parentNode' of 'body'
- // it is frequently sent to this function even
+ // it is frequently sent to this function even
// though it is not Element.
var gcs;
if(d.isWebKit){
@@ -426,7 +428,7 @@ if(dojo.isIE || dojo.isOpera){
runtimeStyle.left = rsLeft;
}
return avalue;
- }
+ };
}
var px = d._toPixelValue;
@@ -454,7 +456,7 @@ if(dojo.isIE || dojo.isOpera){
};
dojo._getOpacity =
- d.isIE ? function(node){
+ d.isIE < 9 ? function(node){
try{
return af(node).Opacity / 100; // Number
}catch(e){
@@ -481,7 +483,7 @@ if(dojo.isIE || dojo.isOpera){
=====*/
dojo._setOpacity =
- d.isIE ? function(/*DomNode*/node, /*Number*/opacity){
+ d.isIE < 9 ? function(/*DomNode*/node, /*Number*/opacity){
var ov = opacity * 100, opaque = opacity == 1;
node.style.zoom = opaque ? "" : 1;
@@ -553,7 +555,7 @@ if(dojo.isIE || dojo.isOpera){
// Also when getting values, use specific style names,
// like "borderBottomWidth" instead of "border" since compound values like
// "border" are not necessarily reflected as expected.
- // If you want to get node dimensions, use `dojo.marginBox()`,
+ // If you want to get node dimensions, use `dojo.marginBox()`,
// `dojo.contentBox()` or `dojo.position()`.
// node:
// id or reference to node to get/set style for
@@ -622,7 +624,7 @@ if(dojo.isIE || dojo.isOpera){
return s;
}
return (args == 1) ? s : _toStyleValue(n, style, s[style] || n.style[style]); /* CSS2Properties||String||Number */
- }
+ };
// =============================
// Box Functions
@@ -635,13 +637,13 @@ if(dojo.isIE || dojo.isOpera){
// 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
+ // | w = the total of the left and right padding
// | h = the total of the top and bottom padding
// If 'node' has position, l/t forms the origin for child nodes.
// The w/h are used for calculating boxes.
// Normally application code will not need to invoke this
// directly, and will use the ...box... functions instead.
- var
+ var
s = computedStyle||gcs(n),
l = px(n, s.paddingLeft),
t = px(n, s.paddingTop);
@@ -651,7 +653,7 @@ if(dojo.isIE || dojo.isOpera){
w: l+px(n, s.paddingRight),
h: t+px(n, s.paddingBottom)
};
- }
+ };
dojo._getBorderExtents = function(/*DomNode*/n, /*Object*/computedStyle){
// summary:
@@ -665,7 +667,7 @@ if(dojo.isIE || dojo.isOpera){
// The w/h are used for calculating boxes.
// Normally application code will not need to invoke this
// directly, and will use the ...box... functions instead.
- var
+ var
ne = "none",
s = computedStyle||gcs(n),
bl = (s.borderLeftStyle != ne ? px(n, s.borderLeftWidth) : 0),
@@ -676,7 +678,7 @@ if(dojo.isIE || dojo.isOpera){
w: bl + (s.borderRightStyle!=ne ? px(n, s.borderRightWidth) : 0),
h: bt + (s.borderBottomStyle!=ne ? px(n, s.borderBottomWidth) : 0)
};
- }
+ };
dojo._getPadBorderExtents = function(/*DomNode*/n, /*Object*/computedStyle){
// summary:
@@ -690,7 +692,7 @@ if(dojo.isIE || dojo.isOpera){
// The w/h are used for calculating boxes.
// Normally application code will not need to invoke this
// directly, and will use the ...box... functions instead.
- var
+ var
s = computedStyle||gcs(n),
p = d._getPadExtents(n, s),
b = d._getBorderExtents(n, s);
@@ -700,7 +702,7 @@ if(dojo.isIE || dojo.isOpera){
w: p.w + b.w,
h: p.h + b.h
};
- }
+ };
dojo._getMarginExtents = function(n, computedStyle){
// summary:
@@ -714,7 +716,7 @@ if(dojo.isIE || dojo.isOpera){
// The w/h are used for calculating boxes.
// Normally application code will not need to invoke this
// directly, and will use the ...box... functions instead.
- var
+ var
s = computedStyle||gcs(n),
l = px(n, s.marginLeft),
t = px(n, s.marginTop),
@@ -722,9 +724,9 @@ if(dojo.isIE || dojo.isOpera){
b = px(n, s.marginBottom);
if(d.isWebKit && (s.position != "absolute")){
// FIXME: Safari's version of the computed right margin
- // is the space between our right edge and the right edge
+ // is the space between our right edge and the right edge
// of our offsetParent.
- // What we are looking for is the actual margin value as
+ // What we are looking for is the actual margin value as
// determined by CSS.
// Hack solution is to assume left/right margins are the same.
r = l;
@@ -735,7 +737,7 @@ if(dojo.isIE || dojo.isOpera){
w: l+r,
h: t+b
};
- }
+ };
// Box getters work in any box context because offsetWidth/clientWidth
// are invariant wrt box context
@@ -743,10 +745,10 @@ if(dojo.isIE || dojo.isOpera){
// They do *not* work for display: inline objects that have padding styles
// because the user agent ignores padding (it's bogus styling in any case)
//
- // Be careful with IMGs because they are inline or block depending on
+ // Be careful with IMGs because they are inline or block depending on
// browser and browser mode.
- // Although it would be easier to read, there are not separate versions of
+ // Although it would be easier to read, there are not separate versions of
// _getMarginBox for each browser because:
// 1. the branching is not expensive
// 2. factoring the shared code wastes cycles (function call overhead)
@@ -790,9 +792,23 @@ if(dojo.isIE || dojo.isOpera){
l: l,
t: t,
w: node.offsetWidth + me.w,
- h: node.offsetHeight + me.h
+ h: node.offsetHeight + me.h
};
}
+
+ dojo._getMarginSize = function(/*DomNode*/node, /*Object*/computedStyle){
+ // summary:
+ // 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));
+
+ var size = node.getBoundingClientRect();
+ return {
+ w: (size.right - size.left) + me.w,
+ h: (size.bottom - size.top) + me.h
+ }
+ }
dojo._getContentBox = function(node, computedStyle){
// summary:
@@ -821,7 +837,7 @@ if(dojo.isIE || dojo.isOpera){
w: w - pe.w - be.w,
h: h - pe.h - be.h
};
- }
+ };
dojo._getBorderBox = function(node, computedStyle){
var s = computedStyle || gcs(node),
@@ -834,7 +850,7 @@ if(dojo.isIE || dojo.isOpera){
w: cb.w + pe.w,
h: cb.h + pe.h
};
- }
+ };
// Box setters depend on box context because interpretation of width/height styles
// vary wrt box context.
@@ -845,12 +861,12 @@ if(dojo.isIE || dojo.isOpera){
// Beware of display: inline objects that have padding styles
// because the user agent ignores padding (it's a bogus setup anyway)
//
- // Be careful with IMGs because they are inline or block depending on
+ // Be careful with IMGs because they are inline or block depending on
// browser and browser mode.
//
// Elements other than DIV may have special quirks, like built-in
// margins or padding, or values not detectable via computedStyle.
- // In particular, margins on TABLE do not seems to appear
+ // In particular, margins on TABLE do not seems to appear
// at all in computedStyle on Mozilla.
dojo._setBox = function(/*DomNode*/node, /*Number?*/l, /*Number?*/t, /*Number?*/w, /*Number?*/h, /*String?*/u){
@@ -876,14 +892,14 @@ if(dojo.isIE || dojo.isOpera){
if(!isNaN(t)){ s.top = t + u; }
if(w >= 0){ s.width = w + u; }
if(h >= 0){ s.height = h + u; }
- }
+ };
dojo._isButtonTag = function(/*DomNode*/node) {
// summary:
// True if the node is BUTTON or INPUT.type="button".
return node.tagName == "BUTTON"
|| node.tagName=="INPUT" && (node.getAttribute("type")||'').toUpperCase() == "BUTTON"; // boolean
- }
+ };
dojo._usesBorderBox = function(/*DomNode*/node){
// summary:
@@ -898,7 +914,7 @@ if(dojo.isIE || dojo.isOpera){
var n = node.tagName;
return d.boxModel=="border-box" || n=="TABLE" || d._isButtonTag(node); // boolean
- }
+ };
dojo._setContentSize = function(/*DomNode*/node, /*Number*/widthPx, /*Number*/heightPx, /*Object*/computedStyle){
// summary:
@@ -910,7 +926,7 @@ if(dojo.isIE || dojo.isOpera){
if(heightPx >= 0){ heightPx += pb.h; }
}
d._setBox(node, NaN, NaN, widthPx, heightPx);
- }
+ };
dojo._setMarginBox = function(/*DomNode*/node, /*Number?*/leftPx, /*Number?*/topPx,
/*Number?*/widthPx, /*Number?*/heightPx,
@@ -942,7 +958,7 @@ if(dojo.isIE || dojo.isOpera){
if(widthPx >= 0){ widthPx = Math.max(widthPx - pb.w - mb.w, 0); }
if(heightPx >= 0){ heightPx = Math.max(heightPx - pb.h - mb.h, 0); }
d._setBox(node, leftPx, topPx, widthPx, heightPx);
- }
+ };
var _nilExtents = { l:0, t:0, w:0, h:0 };
@@ -977,7 +993,7 @@ if(dojo.isIE || dojo.isOpera){
var n = byId(node), s = gcs(n), b = box;
return !b ? d._getMarginBox(n, s) : d._setMarginBox(n, b.l, b.t, b.w, b.h, s); // Object
- }
+ };
dojo.contentBox = function(/*DomNode|String*/node, /*Object?*/box){
// summary:
@@ -1002,14 +1018,14 @@ if(dojo.isIE || dojo.isOpera){
// All properties are optional if passed.
var n = byId(node), s = gcs(n), b = box;
return !b ? d._getContentBox(n, s) : d._setContentSize(n, b.w, b.h, s); // Object
- }
+ };
// =============================
- // Positioning
+ // Positioning
// =============================
var _sumAncestorProperties = function(node, prop){
- if(!(node = (node||0).parentNode)){return 0}
+ if(!(node = (node||0).parentNode)){return 0;}
var val, retVal = 0, _b = d.body();
while(node && node.style){
if(gcs(node).position == "fixed"){
@@ -1025,19 +1041,19 @@ if(dojo.isIE || dojo.isOpera){
node = node.parentNode;
}
return retVal; // integer
- }
+ };
dojo._docScroll = function(){
var n = d.global;
- return "pageXOffset" in n? { x:n.pageXOffset, y:n.pageYOffset } :
- (n=d.doc.documentElement, n.clientHeight? { x:d._fixIeBiDiScrollLeft(n.scrollLeft), y:n.scrollTop } :
- (n=d.body(), { x:n.scrollLeft||0, y:n.scrollTop||0 }));
+ return "pageXOffset" in n
+ ? { x:n.pageXOffset, y:n.pageYOffset }
+ : (n = d.isQuirks? d.doc.body : d.doc.documentElement, { x:d._fixIeBiDiScrollLeft(n.scrollLeft || 0), y:n.scrollTop || 0 });
};
dojo._isBodyLtr = function(){
return "_bodyLtr" in d? d._bodyLtr :
- d._bodyLtr = (d.body().dir || d.doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean
- }
+ d._bodyLtr = (d.body().dir || d.doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean
+ };
dojo._getIeDocumentElementOffset = function(){
// summary:
@@ -1058,7 +1074,7 @@ if(dojo.isIE || dojo.isOpera){
//NOTE: assumes we're being called in an IE browser
- var de = d.doc.documentElement; // only deal with HTML element here, _abs handles body/quirks
+ var de = d.doc.documentElement; // only deal with HTML element here, _abs handles body/quirks
if(d.isIE < 8){
var r = de.getBoundingClientRect(); // works well for IE6+
@@ -1083,18 +1099,22 @@ if(dojo.isIE || dojo.isOpera){
};
dojo._fixIeBiDiScrollLeft = function(/*Integer*/ scrollLeft){
- // In RTL direction, scrollLeft should be a negative value, but IE < 8
+ // In RTL direction, scrollLeft should be a negative value, but IE
// returns a positive one. All codes using documentElement.scrollLeft
// must call this function to fix this error, otherwise the position
// will offset to right when there is a horizontal scrollbar.
- var dd = d.doc;
- if(d.isIE < 8 && !d._isBodyLtr()){
- var de = d.isQuirks ? dd.body : dd.documentElement;
- return scrollLeft + de.clientWidth - de.scrollWidth; // Integer
+ var ie = d.isIE;
+ if(ie && !d._isBodyLtr()){
+ var qk = d.isQuirks,
+ de = qk ? d.doc.body : d.doc.documentElement;
+ if(ie == 6 && !qk && d.global.frameElement && de.scrollHeight > de.clientHeight){
+ scrollLeft += de.clientLeft; // workaround ie6+strict+rtl+iframe+vertical-scrollbar bug where clientWidth is too small by clientLeft pixels
+ }
+ return (ie < 8 || qk) ? (scrollLeft + de.clientWidth - de.scrollWidth) : -scrollLeft; // Integer
}
return scrollLeft; // Integer
- }
+ };
// FIXME: need a setter for coords or a moveTo!!
dojo._abs = dojo.position = function(/*DomNode*/node, /*Boolean?*/includeScroll){
@@ -1112,10 +1132,9 @@ if(dojo.isIE || dojo.isOpera){
// Uses the border-box model (inclusive of border and padding but
// not margin). Does not act as a setter.
- var db = d.body(), dh = db.parentNode, ret;
node = byId(node);
- if(node["getBoundingClientRect"]){
- // IE6+, FF3+, super-modern WebKit, and Opera 9.6+ all take this branch
+ var db = d.body(),
+ dh = db.parentNode,
ret = node.getBoundingClientRect();
ret = { x: ret.left, y: ret.top, w: ret.right - ret.left, h: ret.bottom - ret.top };
if(d.isIE){
@@ -1132,60 +1151,7 @@ if(dojo.isIE || dojo.isOpera){
ret.x -= px(dh, cs.marginLeft) + px(dh, cs.borderLeftWidth);
ret.y -= px(dh, cs.marginTop) + px(dh, cs.borderTopWidth);
}
- }else{
- // FF2 and older WebKit
- ret = {
- x: 0,
- y: 0,
- w: node.offsetWidth,
- h: node.offsetHeight
- };
- if(node["offsetParent"]){
- ret.x -= _sumAncestorProperties(node, "scrollLeft");
- ret.y -= _sumAncestorProperties(node, "scrollTop");
-
- var curnode = node;
- do{
- var n = curnode.offsetLeft,
- t = curnode.offsetTop;
- ret.x += isNaN(n) ? 0 : n;
- ret.y += isNaN(t) ? 0 : t;
-
- cs = gcs(curnode);
- if(curnode != node){
- if(d.isMoz){
- // tried left+right with differently sized left/right borders
- // it really is 2xleft border in FF, not left+right, even in RTL!
- ret.x += 2 * px(curnode,cs.borderLeftWidth);
- ret.y += 2 * px(curnode,cs.borderTopWidth);
- }else{
- ret.x += px(curnode, cs.borderLeftWidth);
- ret.y += px(curnode, cs.borderTopWidth);
- }
- }
- // static children in a static div in FF2 are affected by the div's border as well
- // but offsetParent will skip this div!
- if(d.isMoz && cs.position=="static"){
- var parent=curnode.parentNode;
- while(parent!=curnode.offsetParent){
- var pcs=gcs(parent);
- if(pcs.position=="static"){
- ret.x += px(curnode,pcs.borderLeftWidth);
- ret.y += px(curnode,pcs.borderTopWidth);
- }
- parent=parent.parentNode;
- }
- }
- curnode = curnode.offsetParent;
- }while((curnode != dh) && curnode);
- }else if(node.x && node.y){
- ret.x += isNaN(node.x) ? 0 : node.x;
- ret.y += isNaN(node.y) ? 0 : node.y;
- }
- }
- // account for document scrolling
- // if offsetParent is used, ret value already includes scroll position
- // so we may have to actually remove that value if !includeScroll
+ // account for document scrolling
if(includeScroll){
var scroll = d._docScroll();
ret.x += scroll.x;
@@ -1193,7 +1159,7 @@ if(dojo.isIE || dojo.isOpera){
}
return ret; // Object
- }
+ };
dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){
// summary:
@@ -1215,7 +1181,7 @@ if(dojo.isIE || dojo.isOpera){
mb.x = abs.x;
mb.y = abs.y;
return mb;
- }
+ };
// =============================
// Element attribute Functions
@@ -1277,7 +1243,7 @@ if(dojo.isIE || dojo.isOpera){
// given element, and false otherwise
var lc = name.toLowerCase();
return _forcePropNames[_propNames[lc] || name] || _hasAttr(byId(node), _attrNames[lc] || name); // Boolean
- }
+ };
var _evtHdlrMap = {}, _ctr = 0,
_attrId = dojo._scopeName + "attrid",
@@ -1447,7 +1413,7 @@ if(dojo.isIE || dojo.isOpera){
// node's attribute
// we need _hasAttr() here to guard against IE returning a default value
return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
- }
+ };
dojo.removeAttr = function(/*DomNode|String*/ node, /*String*/ name){
// summary:
@@ -1457,7 +1423,7 @@ if(dojo.isIE || dojo.isOpera){
// name:
// the name of the attribute to remove
byId(node).removeAttribute(_fixAttrName(name));
- }
+ };
dojo.getNodeProp = function(/*DomNode|String*/ node, /*String*/ name){
// summary:
@@ -1476,7 +1442,7 @@ if(dojo.isIE || dojo.isOpera){
// node's attribute
var attrName = _attrNames[lc] || name;
return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
- }
+ };
dojo.create = function(tag, attrs, refNode, pos){
// summary:
@@ -1491,7 +1457,7 @@ if(dojo.isIE || dojo.isOpera){
// Attributes are set by passing the optional object through `dojo.attr`.
// See `dojo.attr` for noted caveats and nuances, and API if applicable.
//|
- // Placement is done via `dojo.place`, assuming the new node to be the action
+ // Placement is done via `dojo.place`, assuming the new node to be the action
// node, passing along the optional reference node and position.
//
// tag: String|DomNode
@@ -1529,7 +1495,7 @@ if(dojo.isIE || dojo.isOpera){
// | 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
+ // 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"];
@@ -1559,7 +1525,7 @@ if(dojo.isIE || dojo.isOpera){
if(attrs){ d.attr(tag, attrs); }
if(refNode){ d.place(tag, refNode, pos); }
return tag; // DomNode
- }
+ };
/*=====
dojo.empty = function(node){
@@ -1627,11 +1593,13 @@ if(dojo.isIE || dojo.isOpera){
// generate start/end tag strings to use
// for the injection for each special tag wrap case.
for(var param in tagWrap){
- var tw = tagWrap[param];
- tw.pre = param == "option" ? '<select multiple="multiple">' : "<" + tw.join("><") + ">";
- tw.post = "</" + tw.reverse().join("></") + ">";
- // the last line is destructive: it reverses the array,
- // but we don't care at this point
+ if(tagWrap.hasOwnProperty(param)){
+ var tw = tagWrap[param];
+ tw.pre = param == "option" ? '<select multiple="multiple">' : "<" + tw.join("><") + ">";
+ tw.post = "</" + tw.reverse().join("></") + ">";
+ // the last line is destructive: it reverses the array,
+ // but we don't care at this point
+ }
}
d._toDom = function(frag, doc){
@@ -1674,7 +1642,7 @@ if(dojo.isIE || dojo.isOpera){
df.appendChild(fc);
}
return df; // DOMNode
- }
+ };
// =============================
// (CSS) Class Functions
@@ -1700,6 +1668,7 @@ if(dojo.isIE || dojo.isOpera){
};
var spaces = /\s+/, a1 = [""],
+ fakeNode = {},
str2array = function(s){
if(typeof s == "string" || s instanceof String){
if(s.indexOf(" ") < 0){
@@ -1805,6 +1774,39 @@ if(dojo.isIE || dojo.isOpera){
if(node[_className] != cls){ node[_className] = cls; }
};
+ dojo.replaceClass = function(/*DomNode|String*/node, /*String|Array*/addClassStr, /*String|Array?*/removeClassStr){
+ // summary:
+ // Replaces one or more classes on a node if not present.
+ // Operates more quickly than calling dojo.removeClass and dojo.addClass
+ // node:
+ // String ID or DomNode reference to remove the class from.
+ // addClassStr:
+ // A String class name to add, or several space-separated class names,
+ // or an array of class names.
+ // removeClassStr:
+ // A String class name to remove, or several space-separated class names,
+ // or an array of class names.
+ //
+ // example:
+ // | dojo.replaceClass("someNode", "add1 add2", "remove1 remove2");
+ //
+ // example:
+ // Replace all classes with addMe
+ // | dojo.replaceClass("someNode", "addMe");
+ //
+ // example:
+ // Available in `dojo.NodeList()` for multiple toggles
+ // | dojo.query(".findMe").replaceClass("addMe", "removeMe");
+
+ node = byId(node);
+ fakeNode.className = node.className;
+ dojo.removeClass(fakeNode, removeClassStr);
+ dojo.addClass(fakeNode, addClassStr);
+ if(node.className !== fakeNode.className){
+ node.className = fakeNode.className;
+ }
+ };
+
dojo.toggleClass = function(/*DomNode|String*/node, /*String|Array*/classStr, /*Boolean?*/condition){
// summary:
// Adds a class to node if not present, or removes if present.
diff --git a/lib/dojo/_base/json.js b/lib/dojo/_base/json.js
index 4d50400c9..4267c225e 100644
--- a/lib/dojo/_base/json.js
+++ b/lib/dojo/_base/json.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo._base.json"]){ //_hasResource checks added by build.
dojo._hasResource["dojo._base.json"] = true;
dojo.provide("dojo._base.json");
+
dojo.fromJson = function(/*String*/ json){
// summary:
// Parses a [JSON](http://json.org) string to return a JavaScript object.
@@ -16,12 +17,12 @@ dojo.fromJson = function(/*String*/ json){
// Throws for invalid JSON strings, but it does not use a strict JSON parser. It
// delegates to eval(). The content passed to this method must therefore come
// from a trusted source.
- // json:
+ // json:
// a string literal of a JSON item, for instance:
// `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
return eval("(" + json + ")"); // Object
-}
+};
dojo._escapeString = function(/*String*/str){
//summary:
@@ -31,7 +32,7 @@ dojo._escapeString = function(/*String*/str){
return ('"' + str.replace(/(["\\])/g, '\\$1') + '"').
replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").
replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string
-}
+};
dojo.toJsonIndentStr = "\t";
dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr){
@@ -75,8 +76,8 @@ dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _ind
if(it === null){
return "null";
}
- if(dojo.isString(it)){
- return dojo._escapeString(it);
+ if(dojo.isString(it)){
+ return dojo._escapeString(it);
}
// recurse
var recurse = arguments.callee;
@@ -149,6 +150,6 @@ dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _ind
output.push(newLine + nextIndent + keyStr + ":" + sep + val);
}
return "{" + output.join("," + sep) + newLine + _indentStr + "}"; // String
-}
+};
}
diff --git a/lib/dojo/_base/lang.js b/lib/dojo/_base/lang.js
index 0e9c7c2f9..9061de01e 100644
--- a/lib/dojo/_base/lang.js
+++ b/lib/dojo/_base/lang.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo._base.lang"]){ //_hasResource checks added by build.
dojo._hasResource["dojo._base.lang"] = true;
dojo.provide("dojo._base.lang");
+
(function(){
var d = dojo, opts = Object.prototype.toString;
@@ -18,14 +19,14 @@ dojo.provide("dojo._base.lang");
// summary:
// Return true if it is a String
return (typeof it == "string" || it instanceof String); // Boolean
- }
+ };
dojo.isArray = function(/*anything*/ it){
// summary:
// Return true if it is an Array.
// Does not work on Arrays created in other windows.
return it && (it instanceof Array || typeof it == "array"); // Boolean
- }
+ };
dojo.isFunction = function(/*anything*/ it){
// summary:
@@ -39,7 +40,7 @@ dojo.provide("dojo._base.lang");
// or null)
return it !== undefined &&
(it === null || typeof it == "object" || d.isArray(it) || d.isFunction(it)); // Boolean
- }
+ };
dojo.isArrayLike = function(/*anything*/ it){
// summary:
@@ -58,14 +59,14 @@ dojo.provide("dojo._base.lang");
!d.isString(it) && !d.isFunction(it) &&
!(it.tagName && it.tagName.toLowerCase() == 'form') &&
(d.isArray(it) || isFinite(it.length));
- }
+ };
dojo.isAlien = function(/*anything*/ it){
// summary:
// Returns true if it is a built-in function or some other kind of
// oddball that *should* report as a function but doesn't
return it && !d.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
- }
+ };
dojo.extend = function(/*Object*/ constructor, /*Object...*/ props){
// summary:
@@ -76,7 +77,7 @@ dojo.provide("dojo._base.lang");
d._mixin(constructor.prototype, arguments[i]);
}
return constructor; // Object
- }
+ };
dojo._hitchArgs = function(scope, method /*,...*/){
var pre = d._toArray(arguments, 2);
@@ -88,8 +89,8 @@ dojo.provide("dojo._base.lang");
var f = named ? (scope||d.global)[method] : method;
// invoke with collected args
return f && f.apply(scope || this, pre.concat(args)); // mixed
- } // Function
- }
+ }; // Function
+ };
dojo.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/){
// summary:
@@ -97,7 +98,7 @@ dojo.provide("dojo._base.lang");
// This allows for easy use of object member functions
// in callbacks and other places in which the "this" keyword may
// otherwise not reference the expected scope.
- // Any number of default positional arguments may be passed as parameters
+ // Any number of default positional arguments may be passed as parameters
// beyond "method".
// Each of these values will be used to "placehold" (similar to curry)
// for the hitched function.
@@ -137,7 +138,7 @@ dojo.provide("dojo._base.lang");
return function(){ return scope[method].apply(scope, arguments || []); }; // Function
}
return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function
- }
+ };
/*=====
dojo.delegate = function(obj, props){
@@ -181,7 +182,7 @@ dojo.provide("dojo._base.lang");
d._mixin(tmp, props);
}
return tmp; // Object
- }
+ };
})();
/*=====
@@ -230,7 +231,7 @@ dojo.provide("dojo._base.lang");
// | dojo.hitch(null, funcName, ...);
var arr = [ null ];
return d.hitch.apply(d, arr.concat(d._toArray(arguments))); // Function
- }
+ };
var extraNames = d._extraNames, extraLen = extraNames.length, empty = {};
@@ -250,6 +251,10 @@ dojo.provide("dojo._base.lang");
// Date
return new Date(o.getTime()); // Date
}
+ if(o instanceof RegExp){
+ // RegExp
+ return new RegExp(o); // RegExp
+ }
var r, i, l, s, name;
if(d.isArray(o)){
// array
@@ -288,7 +293,7 @@ dojo.provide("dojo._base.lang");
}
}
return r; // Object
- }
+ };
/*=====
dojo.trim = function(str){
@@ -317,7 +322,7 @@ dojo.provide("dojo._base.lang");
dojo.replace = function(tmpl, map, pattern){
// summary:
// Performs parameterized substitutions on a string. Throws an
- // exception if any parameter is unmatched.
+ // exception if any parameter is unmatched.
// tmpl: String
// String to be used as a template.
// map: Object|Function
diff --git a/lib/dojo/_base/query-sizzle.js b/lib/dojo/_base/query-sizzle.js
index 5d160ec55..aad4e824d 100644
--- a/lib/dojo/_base/query-sizzle.js
+++ b/lib/dojo/_base/query-sizzle.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -20,11 +20,7 @@ dojo._hasResource["dojo._base.query"] = true;
* Finally, dojo.provide/require added.
*/
-//This file gets copied to dojo/_base/query.js, so set the provide accordingly.
-if(typeof dojo != "undefined"){
- dojo.provide("dojo._base.query");
- dojo.require("dojo._base.NodeList");
-
+var startDojoMappings= function(dojo) {
//Start Dojo mappings.
dojo.query = function(/*String*/ query, /*String|DOMNode?*/ root, /*Function?*/listCtor){
listCtor = listCtor || dojo.NodeList;
@@ -45,16 +41,16 @@ if(typeof dojo != "undefined"){
}
return dojo.Sizzle(query, root, new listCtor());
- }
+ };
dojo._filterQueryResult = function(nodeList, simpleFilter){
return dojo.Sizzle.filter(simpleFilter, nodeList);
- }
-}
+ };
+};
//Main Sizzle code follows...
//ns argument, added for dojo, used at the end of the file.
-;(function(ns){
+var defineSizzle= function(ns){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
@@ -862,8 +858,20 @@ var contains = document.compareDocumentPosition ? function(a, b){
// EXPOSE
-(ns || window).Sizzle = Sizzle;
+ns.Sizzle = Sizzle;
-})(typeof dojo == "undefined" ? null : dojo);
+};
+
+if (this["dojo"]) {
+ var defined= 0;
+ if (!defined) {
+ // must be in a built version that stripped out the define above
+ dojo.provide("dojo._base.query");
+ dojo.require("dojo._base.NodeList");
+ defineSizzle(dojo);
+ } // else must be in a source version (or a build that likes define)
+} else {
+ defineSizzle(window);
+}
}
diff --git a/lib/dojo/_base/query.js b/lib/dojo/_base/query.js
index 7b9878e47..59411952f 100644
--- a/lib/dojo/_base/query.js
+++ b/lib/dojo/_base/query.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -7,12 +7,7 @@
if(!dojo._hasResource["dojo._base.query"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.query"] = true;
-if(typeof dojo != "undefined"){
- dojo.provide("dojo._base.query");
- dojo.require("dojo._base.NodeList");
- dojo.require("dojo._base.lang");
-
-}
+(function(){
/*
dojo.query() architectural overview:
@@ -46,7 +41,7 @@ if(typeof dojo != "undefined"){
5.) matched nodes are pruned to ensure they are unique (if necessary)
*/
-;(function(d){
+var defineQuery= function(d){
// define everything in a closure for compressability reasons. "d" is an
// alias to "dojo" (or the toolkit alias object, e.g., "acme").
@@ -54,7 +49,7 @@ if(typeof dojo != "undefined"){
// Toolkit aliases
////////////////////////////////////////////////////////////////////////
- // if you are extracing dojo.query for use in your own system, you will
+ // if you are extracting dojo.query for use in your own system, you will
// need to provide these methods and properties. No other porting should be
// necessary, save for configuring the system to use a class other than
// dojo.NodeList as the return instance instantiator
@@ -65,7 +60,7 @@ if(typeof dojo != "undefined"){
// d.isOpera; // float
// d.isWebKit; // float
// d.doc ; // document element
- var qlc = d._NodeListCtor = d.NodeList;
+ var qlc = (d._NodeListCtor = d.NodeList);
var getDoc = function(){ return d.doc; };
// NOTE(alex): the spec is idiotic. CSS queries should ALWAYS be case-sensitive, but nooooooo
@@ -96,7 +91,7 @@ if(typeof dojo != "undefined"){
////////////////////////////////////////////////////////////////////////
var getQueryParts = function(query){
- // summary:
+ // summary:
// state machine for query tokenization
// description:
// instead of using a brittle and slow regex-based CSS parser,
@@ -105,16 +100,16 @@ if(typeof dojo != "undefined"){
// the same query run multiple times or under different root nodes
// does not re-parse the selector expression but instead uses the
// cached data structure. The state machine implemented here
- // terminates on the last " " (space) charachter and returns an
+ // terminates on the last " " (space) character and returns an
// ordered array of query component structures (or "parts"). Each
// part represents an operator or a simple CSS filtering
// expression. The structure for parts is documented in the code
// below.
- // NOTE:
+ // NOTE:
// this code is designed to run fast and compress well. Sacrifices
- // to readibility 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
@@ -130,7 +125,7 @@ if(typeof dojo != "undefined"){
}
var ts = function(/*Integer*/ s, /*Integer*/ e){
- // trim and slice.
+ // trim and slice.
// take an index to start a string slice from and an end position
// and return a trimmed copy of that sub-string
@@ -138,12 +133,12 @@ if(typeof dojo != "undefined"){
}
// the overall data graph of the full query, as represented by queryPart objects
- var queryParts = [];
+ var queryParts = [];
// state keeping vars
- var inBrackets = -1, inParens = -1, inMatchFor = -1,
- inPseudo = -1, inClass = -1, inId = -1, inTag = -1,
+ var inBrackets = -1, inParens = -1, inMatchFor = -1,
+ inPseudo = -1, inClass = -1, inId = -1, inTag = -1,
lc = "", cc = "", pStart;
// iteration vars
@@ -152,7 +147,7 @@ if(typeof dojo != "undefined"){
currentPart = null, // data structure representing the entire clause
_cp = null; // the current pseudo or attr matcher
- // several temporary variables are assigned to this structure durring a
+ // several temporary variables are assigned to this structure during a
// potential sub-expression match:
// attr:
// a string representing the current full attribute match in a
@@ -207,9 +202,9 @@ if(typeof dojo != "undefined"){
// needs to do any iteration. Many simple selectors don't, and
// we can avoid significant construction-time work by advising
// the system to skip them
- currentPart.loops = (
- currentPart.pseudos.length ||
- currentPart.attrs.length ||
+ currentPart.loops = (
+ currentPart.pseudos.length ||
+ currentPart.attrs.length ||
currentPart.classes.length );
currentPart.oquery = currentPart.query = ts(pStart, x); // save the full expression as a string
@@ -239,9 +234,9 @@ if(typeof dojo != "undefined"){
currentPart.infixOper = queryParts.pop();
currentPart.query = currentPart.infixOper.query + " " + currentPart.query;
/*
- console.debug( "swapping out the infix",
- currentPart.infixOper,
- "and attaching it to",
+ console.debug( "swapping out the infix",
+ currentPart.infixOper,
+ "and attaching it to",
currentPart);
*/
}
@@ -250,15 +245,15 @@ if(typeof dojo != "undefined"){
currentPart = null;
}
- // iterate over the query, charachter by charachter, building up a
+ // iterate over the query, character by character, building up a
// list of query part objects
for(; lc=cc, cc=query.charAt(x), x < ql; x++){
// cc: the current character in the match
- // lc: the last charachter (if any)
+ // lc: the last character (if any)
// someone is trying to escape something, so don't try to match any
// fragments. We assume we're inside a literal.
- if(lc == "\\"){ continue; }
+ if(lc == "\\"){ continue; }
if(!currentPart){ // a part was just ended or none has yet been created
// NOTE: I hate all this alloc, but it's shorter than writing tons of if's
pStart = x;
@@ -301,7 +296,7 @@ if(typeof dojo != "undefined"){
// the beginning of a match, which should be a tag name. This
// might fault a little later on, but we detect that and this
// iteration will still be fine.
- inTag = x;
+ inTag = x;
}
if(inBrackets >= 0){
@@ -309,7 +304,7 @@ if(typeof dojo != "undefined"){
if(cc == "]"){ // if we're in a [...] clause and we end, do assignment
if(!_cp.attr){
// no attribute match was previously begun, so we
- // assume this is an attribute existance match in the
+ // assume this is an attribute existence match in the
// form of [someAttributeName]
_cp.attr = ts(inBrackets+1, x);
}else{
@@ -320,19 +315,19 @@ if(typeof dojo != "undefined"){
var cmf = _cp.matchFor;
if(cmf){
// try to strip quotes from the matchFor value. We want
- // [attrName=howdy] to match the same
+ // [attrName=howdy] to match the same
// as [attrName = 'howdy' ]
if( (cmf.charAt(0) == '"') || (cmf.charAt(0) == "'") ){
_cp.matchFor = cmf.slice(1, -1);
}
}
- // end the attribute by adding it to the list of attributes.
+ // end the attribute by adding it to the list of attributes.
currentPart.attrs.push(_cp);
_cp = null; // necessary?
inBrackets = inMatchFor = -1;
}else if(cc == "="){
// if the last char was an operator prefix, make sure we
- // record it along with the "=" operator.
+ // record it along with the "=" operator.
var addToCc = ("|~^$*".indexOf(lc) >=0 ) ? lc : "";
_cp.type = addToCc+cc;
_cp.attr = ts(inBrackets+1, x-addToCc.length);
@@ -341,7 +336,7 @@ if(typeof dojo != "undefined"){
// now look for other clause parts
}else if(inParens >= 0){
// if we're in a parenthetical expression, we need to figure
- // out if it's attached to a pseduo-selector rule like
+ // out if it's attached to a pseudo-selector rule like
// :nth-child(1)
if(cc == ")"){
if(inPseudo >= 0){
@@ -362,7 +357,7 @@ if(typeof dojo != "undefined"){
endAll();
inPseudo = x;
}else if(cc == "["){
- // start of an attribute match.
+ // start of an attribute match.
endAll();
inBrackets = x;
// provide a new structure for the attribute match to fill-in
@@ -376,15 +371,15 @@ if(typeof dojo != "undefined"){
// expression if we're already inside a pseudo-selector match
if(inPseudo >= 0){
// provide a new structure for the pseudo match to fill-in
- _cp = {
- name: ts(inPseudo+1, x),
+ _cp = {
+ name: ts(inPseudo+1, x),
value: null
}
currentPart.pseudos.push(_cp);
}
inParens = x;
}else if(
- (cc == " ") &&
+ (cc == " ") &&
// if it's a space char and the last char is too, consume the
// current one without doing more work
(lc != cc)
@@ -404,7 +399,7 @@ if(typeof dojo != "undefined"){
// the basic building block of the yes/no chaining system. agree(f1,
// f2) generates a new function which returns the boolean results of
// both of the passed functions to a single logical-anded result. If
- // either are not possed, the other is used exclusively.
+ // either are not passed, the other is used exclusively.
if(!first){ return second; }
if(!second){ return first; }
@@ -456,7 +451,7 @@ if(typeof dojo != "undefined"){
}
},
"$=": function(attr, value){
- // E[foo$="bar"]
+ // E[foo$="bar"]
// an E element whose "foo" attribute value ends exactly
// with the string "bar"
var tval = " "+value;
@@ -466,7 +461,7 @@ if(typeof dojo != "undefined"){
}
},
"~=": function(attr, value){
- // E[foo~="bar"]
+ // E[foo~="bar"]
// an E element whose "foo" attribute value is a list of
// space-separated values, one of which is exactly equal
// to "bar"
@@ -532,7 +527,7 @@ if(typeof dojo != "undefined"){
if(!tret){ return -1; }
var l = tret.length;
- // we calcuate the parent length as a cheap way to invalidate the
+ // we calculate the parent length as a cheap way to invalidate the
// cache. It's not 100% accurate, but it's much more honest than what
// other libraries do
if( cl == l && ci >= 0 && cl >= 0 ){
@@ -544,11 +539,11 @@ if(typeof dojo != "undefined"){
root["_l"] = l;
ci = -1;
for(var te = root["firstElementChild"]||root["firstChild"]; te; te = te[_ns]){
- if(_simpleNodeTest(te)){
+ if(_simpleNodeTest(te)){
te["_i"] = ++i;
- if(node === te){
+ if(node === te){
// NOTE:
- // shortcuting the return at this step in indexing works
+ // shortcutting the return at this step in indexing works
// very well for benchmarking but we avoid it here since
// it leads to potential O(n^2) behavior in sequential
// getNodexIndex operations on a previously un-indexed
@@ -579,7 +574,7 @@ if(typeof dojo != "undefined"){
"first-child": function(){ return _lookLeft; },
"last-child": function(){ return _lookRight; },
"only-child": function(name, condition){
- return function(node){
+ return function(node){
if(!_lookLeft(node)){ return false; }
if(!_lookRight(node)){ return false; }
return true;
@@ -610,7 +605,7 @@ if(typeof dojo != "undefined"){
},
"not": function(name, condition){
var p = getQueryParts(condition)[0];
- var ignores = { el: 1 };
+ var ignores = { el: 1 };
if(p.tag != "*"){
ignores.tag = 1;
}
@@ -670,7 +665,7 @@ if(typeof dojo != "undefined"){
}
};
- var defaultGetter = (d.isIE) ? function(cond){
+ var defaultGetter = (d.isIE < 9 || (dojo.isIE && dojo.isQuirks)) ? function(cond){
var clc = cond.toLowerCase();
if(clc == "class"){ cond = "className"; }
return function(elem){
@@ -684,7 +679,7 @@ if(typeof dojo != "undefined"){
var getSimpleFilterFunc = function(query, ignores){
// generates a node tester function based on the passed query part. The
- // query part is one of the structures generatd by the query parser
+ // query part is one of the structures generated by the query parser
// when it creates the query AST. The "ignores" object specifies which
// (if any) tests to skip, allowing the system to avoid duplicating
// work where it may have already been taken into account by other
@@ -715,7 +710,7 @@ if(typeof dojo != "undefined"){
if(isWildcard){
cname = cname.substr(0, cname.length-1);
}
- // I dislike the regex thing, even if memozied in a cache, but it's VERY short
+ // I dislike the regex thing, even if memoized in a cache, but it's VERY short
var re = new RegExp("(?:^|\\s)" + cname + (isWildcard ? ".*" : "") + "(?:\\s|$)");
*/
var re = new RegExp("(?:^|\\s)" + cname + "(?:\\s|$)");
@@ -753,7 +748,7 @@ if(typeof dojo != "undefined"){
if(!("id" in ignores)){
if(query.id){
- ff = agree(ff, function(elem){
+ ff = agree(ff, function(elem){
return (!!elem && (elem.id == query.id));
});
}
@@ -761,7 +756,7 @@ if(typeof dojo != "undefined"){
if(!ff){
if(!("default" in ignores)){
- ff = yesman;
+ ff = yesman;
}
}
return ff;
@@ -812,7 +807,7 @@ if(typeof dojo != "undefined"){
_simpleNodeTest(te) &&
(!bag || _isUnique(te, bag)) &&
(filterFunc(te, x))
- ){
+ ){
ret.push(te);
}
}
@@ -854,7 +849,7 @@ if(typeof dojo != "undefined"){
// 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
- // founde, a test function is applied to weed out the ones we
+ // found, a test function is applied to weed out the ones we
// don't want. Many common cases can be fast-pathed. We spend a
// lot of cycles to create a dispatcher that doesn't do more work
// than necessary at any point since, unlike this function, the
@@ -907,7 +902,7 @@ if(typeof dojo != "undefined"){
var filterFunc = getSimpleFilterFunc(query, { el: 1 });
var qt = query.tag;
var wildcardTag = ("*" == qt);
- var ecs = getDoc()["getElementsByClassName"];
+ var ecs = getDoc()["getElementsByClassName"];
if(!oper){
// if there's no infix operator, then it's a descendant query. ID
@@ -917,8 +912,8 @@ if(typeof dojo != "undefined"){
// testing shows that the overhead of yesman() is acceptable
// and can save us some bytes vs. re-defining the function
// everywhere.
- filterFunc = (!query.loops && wildcardTag) ?
- yesman :
+ filterFunc = (!query.loops && wildcardTag) ?
+ yesman :
getSimpleFilterFunc(query, { el: 1, id: 1 });
retFunc = function(root, arr){
@@ -933,9 +928,9 @@ if(typeof dojo != "undefined"){
}
}
}else if(
- ecs &&
+ ecs &&
// isAlien check. Workaround for Prototype.js being totally evil/dumb.
- /\{\s*\[native code\]\s*\}/.test(String(ecs)) &&
+ /\{\s*\[native code\]\s*\}/.test(String(ecs)) &&
query.classes.length &&
!cssCaseBug
){
@@ -1101,8 +1096,8 @@ if(typeof dojo != "undefined"){
// We need te detect the right "internal" webkit version to make this work.
var wk = "WebKit/";
var is525 = (
- d.isWebKit &&
- (nua.indexOf(wk) > 0) &&
+ d.isWebKit &&
+ (nua.indexOf(wk) > 0) &&
(parseFloat(nua.split(wk)[1]) > 528)
);
@@ -1113,7 +1108,7 @@ if(typeof dojo != "undefined"){
var qsa = "querySelectorAll";
var qsaAvail = (
- !!getDoc()[qsa] &&
+ !!getDoc()[qsa] &&
// see #5832
(!d.isSafari || (d.isSafari > 3.1) || is525 )
);
@@ -1142,7 +1137,7 @@ if(typeof dojo != "undefined"){
var domCached = _queryFuncCacheDOM[query];
if(domCached){ return domCached; }
- // TODO:
+ // TODO:
// today we're caching DOM and QSA branches separately so we
// recalc useQSA every time. If we had a way to tag root+query
// efficiently, we'd be in good shape to do a global cache.
@@ -1156,11 +1151,11 @@ if(typeof dojo != "undefined"){
forceDOM = true;
}
- var useQSA = (
+ var useQSA = (
qsaAvail && (!forceDOM) &&
// as per CSS 3, we can't currently start w/ combinator:
// http://www.w3.org/TR/css3-selectors/#w3cselgrammar
- (specials.indexOf(qcz) == -1) &&
+ (specials.indexOf(qcz) == -1) &&
// IE's QSA impl sucks on pseudos
(!d.isIE || (query.indexOf(":") == -1)) &&
@@ -1173,11 +1168,11 @@ if(typeof dojo != "undefined"){
// elements, even though according to spec, selected options should
// match :checked. So go nonQSA for it:
// http://bugs.dojotoolkit.org/ticket/5179
- (query.indexOf(":contains") == -1) && (query.indexOf(":checked") == -1) &&
+ (query.indexOf(":contains") == -1) && (query.indexOf(":checked") == -1) &&
(query.indexOf("|=") == -1) // some browsers don't grok it
);
- // TODO:
+ // TODO:
// if we've got a descendant query (e.g., "> .thinger" instead of
// just ".thinger") in a QSA-able doc, but are passed a child as a
// root, it should be possible to give the item a synthetic ID and
@@ -1186,7 +1181,7 @@ if(typeof dojo != "undefined"){
if(useQSA){
- var tq = (specials.indexOf(query.charAt(query.length-1)) >= 0) ?
+ var tq = (specials.indexOf(query.charAt(query.length-1)) >= 0) ?
(query + " *") : query;
return _queryFuncCacheQSA[query] = function(root){
try{
@@ -1213,9 +1208,9 @@ if(typeof dojo != "undefined"){
}else{
// DOM branch
var parts = query.split(/\s*,\s*/);
- return _queryFuncCacheDOM[query] = ((parts.length < 2) ?
+ return _queryFuncCacheDOM[query] = ((parts.length < 2) ?
// if not a compound query (e.g., ".foo, .bar"), cache and return a dispatcher
- getStepQueryFunc(query) :
+ getStepQueryFunc(query) :
// if it *is* a complex query, break it up into its
// constituent parts and return a dispatcher that will
// merge the parts when run
@@ -1245,7 +1240,7 @@ if(typeof dojo != "undefined"){
}else{
return node.uniqueID;
}
- } :
+ } :
function(node){
return (node._uid || (node._uid = ++_zipIdx));
};
@@ -1254,7 +1249,7 @@ if(typeof dojo != "undefined"){
// to flatten a list of unique items, but rather just tell if the item in
// question is already in the bag. Normally we'd just use hash lookup to do
// this for us but IE's DOM is busted so we can't really count on that. On
- // the upside, it gives us a built in unique ID function.
+ // the upside, it gives us a built in unique ID function.
var _isUnique = function(node, bag){
if(!bag){ return 1; }
var id = _nodeUID(node);
@@ -1266,7 +1261,7 @@ if(typeof dojo != "undefined"){
// returning a list of "uniques", hopefully in doucment order
var _zipIdxName = "_zipIdx";
var _zip = function(arr){
- if(arr && arr.nozip){
+ if(arr && arr.nozip){
return (qlc._wrap) ? qlc._wrap(arr) : arr;
}
// var ret = new d._NodeListCtor();
@@ -1285,7 +1280,7 @@ if(typeof dojo != "undefined"){
var szidx = _zipIdx+"";
arr[0].setAttribute(_zipIdxName, szidx);
for(var x = 1, te; te = arr[x]; x++){
- if(arr[x].getAttribute(_zipIdxName) != szidx){
+ if(arr[x].getAttribute(_zipIdxName) != szidx){
ret.push(te);
}
te.setAttribute(_zipIdxName, szidx);
@@ -1293,7 +1288,7 @@ if(typeof dojo != "undefined"){
}else if(d.isIE && arr.commentStrip){
try{
for(var x = 1, te; te = arr[x]; x++){
- if(_isElement(te)){
+ if(_isElement(te)){
ret.push(te);
}
}
@@ -1301,7 +1296,7 @@ if(typeof dojo != "undefined"){
}else{
if(arr[0]){ arr[0][_zipIdxName] = _zipIdx; }
for(var x = 1, te; te = arr[x]; x++){
- if(arr[x][_zipIdxName] != _zipIdx){
+ if(arr[x][_zipIdxName] != _zipIdx){
ret.push(te);
}
te[_zipIdxName] = _zipIdx;
@@ -1331,11 +1326,11 @@ if(typeof dojo != "undefined"){
// * class selectors (e.g., `.foo`)
// * node type selectors like `span`
// * ` ` descendant selectors
- // * `>` child element selectors
+ // * `>` child element selectors
// * `#foo` style ID selectors
// * `*` universal selector
- // * `~`, the immediately preceeded-by sibling selector
- // * `+`, the preceeded-by sibling selector
+ // * `~`, the preceded-by sibling selector
+ // * `+`, the immediately preceded-by sibling selector
// * attribute queries:
// | * `[foo]` attribute presence selector
// | * `[foo='bar']` attribute value exact match
@@ -1356,14 +1351,14 @@ if(typeof dojo != "undefined"){
// palette of selectors and when combined with functions for
// manipulation presented by dojo.NodeList, many types of DOM
// manipulation operations become very straightforward.
- //
+ //
// Unsupported Selectors:
// ----------------------
//
// While dojo.query handles many CSS3 selectors, some fall outside of
- // what's resaonable for a programmatic node querying engine to
+ // what's reasonable for a programmatic node querying engine to
// handle. Currently unsupported selectors include:
- //
+ //
// * namespace-differentiated selectors of any form
// * all `::` pseduo-element selectors
// * certain pseduo-selectors which don't get a lot of day-to-day use:
@@ -1372,10 +1367,10 @@ if(typeof dojo != "undefined"){
// | * `:root`, `:active`, `:hover`, `:visisted`, `:link`,
// `:enabled`, `:disabled`
// * `:*-of-type` pseudo selectors
- //
+ //
// dojo.query and XML Documents:
// -----------------------------
- //
+ //
// `dojo.query` (as of dojo 1.2) supports searching XML documents
// in a case-sensitive manner. If an HTML document is served with
// a doctype that forces case-sensitivity (e.g., XHTML 1.1
@@ -1485,12 +1480,12 @@ if(typeof dojo != "undefined"){
// NOTE:
// Opera in XHTML mode doesn't detect case-sensitivity correctly
// and it's not clear that there's any way to test for it
- caseSensitive = (root.contentType && root.contentType=="application/xml") ||
+ caseSensitive = (root.contentType && root.contentType=="application/xml") ||
(d.isOpera && (root.doctype || od.toString() == "[object XMLDocument]")) ||
- (!!od) &&
+ (!!od) &&
(d.isIE ? od.xml : (root.xmlVersion||od.xmlVersion));
- // NOTE:
+ // NOTE:
// adding "true" as the 2nd argument to getQueryFunc is useful for
// testing the DOM branch without worrying about the
// behavior/performance of the QSA branch.
@@ -1507,16 +1502,98 @@ if(typeof dojo != "undefined"){
// FIXME: need to add infrastructure for post-filtering pseudos, ala :last
d.query.pseudos = pseudos;
- // one-off function for filtering a NodeList based on a simple selector
- d._filterQueryResult = function(nodeList, simpleFilter){
- var tmpNodeList = new d._NodeListCtor();
- var filterFunc = getSimpleFilterFunc(getQueryParts(simpleFilter)[0]);
+ // function for filtering a NodeList based on a selector, optimized for simple selectors
+ d._filterQueryResult = function(/*NodeList*/ nodeList, /*String*/ filter, /*String|DOMNode?*/ root){
+ var tmpNodeList = new d._NodeListCtor(),
+ parts = getQueryParts(filter),
+ filterFunc =
+ (parts.length == 1 && !/[^\w#\.]/.test(filter)) ?
+ getSimpleFilterFunc(parts[0]) :
+ function(node) {
+ return dojo.query(filter, root).indexOf(node) != -1;
+ };
for(var x = 0, te; te = nodeList[x]; x++){
if(filterFunc(te)){ tmpNodeList.push(te); }
}
return tmpNodeList;
}
-})(this["queryPortability"]||this["acme"]||dojo);
+};//end defineQuery
+
+var defineAcme= function(){
+ // a self-sufficient query impl
+ acme = {
+ trim: function(/*String*/ str){
+ // summary:
+ // trims whitespaces from both sides of the string
+ str = str.replace(/^\s+/, '');
+ for(var i = str.length - 1; i >= 0; i--){
+ if(/\S/.test(str.charAt(i))){
+ str = str.substring(0, i + 1);
+ break;
+ }
+ }
+ return str; // String
+ },
+ forEach: function(/*String*/ arr, /*Function*/ callback, /*Object?*/ thisObject){
+ // summary:
+ // an iterator function that passes items, indexes,
+ // and the array to a callback
+ if(!arr || !arr.length){ return; }
+ for(var i=0,l=arr.length; i<l; ++i){
+ callback.call(thisObject||window, arr[i], i, arr);
+ }
+ },
+ byId: function(id, doc){
+ // summary:
+ // a function that return an element by ID, but also
+ // accepts nodes safely
+ if(typeof id == "string"){
+ return (doc||document).getElementById(id); // DomNode
+ }else{
+ return id; // DomNode
+ }
+ },
+ // the default document to search
+ doc: document,
+ // the constructor for node list objects returned from query()
+ NodeList: Array
+ };
+
+ // define acme.isIE, acme.isSafari, acme.isOpera, etc.
+ var n = navigator;
+ var dua = n.userAgent;
+ var dav = n.appVersion;
+ var tv = parseFloat(dav);
+ acme.isOpera = (dua.indexOf("Opera") >= 0) ? tv: undefined;
+ acme.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : undefined;
+ acme.isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
+ acme.isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
+ var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
+ if(index && !acme.isChrome){
+ acme.isSafari = parseFloat(dav.split("Version/")[1]);
+ if(!acme.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3){
+ acme.isSafari = 2;
+ }
+ }
+ if(document.all && !acme.isOpera){
+ acme.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
+ }
+
+ Array._wrap = function(arr){ return arr; };
+ return acme;
+};
+
+ //prefers queryPortability, then acme, then dojo
+ if(this["dojo"]){
+ dojo.provide("dojo._base.query");
+ dojo.require("dojo._base.NodeList");
+ dojo.require("dojo._base.lang");
+ defineQuery(this["queryPortability"]||this["acme"]||dojo);
+ }else{
+ defineQuery(this["queryPortability"]||this["acme"]||defineAcme());
+ }
+
+})();
/*
*/
diff --git a/lib/dojo/_base/window.js b/lib/dojo/_base/window.js
index 5c6e2e952..143bad610 100644
--- a/lib/dojo/_base/window.js
+++ b/lib/dojo/_base/window.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo._base.window"]){ //_hasResource checks added by buil
dojo._hasResource["dojo._base.window"] = true;
dojo.provide("dojo._base.window");
+
/*=====
dojo.doc = {
// summary:
@@ -34,7 +35,7 @@ dojo.body = function(){
// Note: document.body is not defined for a strict xhtml document
// Would like to memoize this, but dojo.doc can change vi dojo.withDoc().
return dojo.doc.body || dojo.doc.getElementsByTagName("body")[0]; // Node
-}
+};
dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocument){
// summary:
@@ -47,9 +48,9 @@ dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocu
dojo.doc = globalDocument;
};
-dojo.withGlobal = function( /*Object*/globalObject,
- /*Function*/callback,
- /*Object?*/thisObject,
+dojo.withGlobal = function( /*Object*/globalObject,
+ /*Function*/callback,
+ /*Object?*/thisObject,
/*Array?*/cbArguments){
// summary:
// Invoke callback with globalObject as dojo.global and
@@ -68,11 +69,11 @@ dojo.withGlobal = function( /*Object*/globalObject,
}finally{
dojo.global = oldGlob;
}
-}
+};
-dojo.withDoc = function( /*DocumentElement*/documentObject,
- /*Function*/callback,
- /*Object?*/thisObject,
+dojo.withDoc = function( /*DocumentElement*/documentObject,
+ /*Function*/callback,
+ /*Object?*/thisObject,
/*Array?*/cbArguments){
// summary:
// Invoke callback with documentObject as dojo.doc.
@@ -103,6 +104,5 @@ dojo.withDoc = function( /*DocumentElement*/documentObject,
dojo.isQuirks = oldQ;
}
};
-
}
diff --git a/lib/dojo/_base/xhr.js b/lib/dojo/_base/xhr.js
index 818f8e418..58f1fdb62 100644
--- a/lib/dojo/_base/xhr.js
+++ b/lib/dojo/_base/xhr.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -13,6 +13,7 @@ dojo.require("dojo._base.json");
dojo.require("dojo._base.lang");
dojo.require("dojo._base.query");
+
(function(){
var _d = dojo, cfg = _d.config;
@@ -53,7 +54,7 @@ dojo.require("dojo._base.query");
var type = (item.type||"").toLowerCase();
if(_in && type && !item.disabled){
if(type == "radio" || type == "checkbox"){
- if(item.checked){ ret = item.value }
+ if(item.checked){ ret = item.value; }
}else if(item.multiple){
ret = [];
_d.query("option", item).forEach(function(opt){
@@ -67,7 +68,7 @@ dojo.require("dojo._base.query");
}
}
return ret; // Object
- }
+ };
dojo.formToObject = function(/*DOMNode||String*/ formNode){
// summary:
@@ -94,7 +95,7 @@ dojo.require("dojo._base.query");
// yields this object structure as the result of a call to
// formToObject():
//
- // | {
+ // | {
// | blah: "blah",
// | multi: [
// | "thud",
@@ -115,7 +116,7 @@ dojo.require("dojo._base.query");
}
});
return ret; // Object
- }
+ };
dojo.objectToQuery = function(/*Object*/ map){
// summary:
@@ -124,7 +125,7 @@ dojo.require("dojo._base.query");
// example:
// this object:
//
- // | {
+ // | {
// | blah: "blah",
// | multi: [
// | "thud",
@@ -133,7 +134,7 @@ dojo.require("dojo._base.query");
// | };
//
// yields the following query string:
- //
+ //
// | "blah=blah&multi=thud&multi=thonk"
// FIXME: need to implement encodeAscii!!
@@ -154,21 +155,21 @@ dojo.require("dojo._base.query");
}
}
return pairs.join("&"); // String
- }
+ };
dojo.formToQuery = function(/*DOMNode||String*/ formNode){
// summary:
// Returns a URL-encoded string representing the form passed as either a
// node or string ID identifying the form to serialize
return _d.objectToQuery(_d.formToObject(formNode)); // String
- }
+ };
dojo.formToJson = function(/*DOMNode||String*/ formNode, /*Boolean?*/prettyPrint){
// summary:
// Create a serialized JSON string from a form node or string
// ID identifying the form to serialize
return _d.toJson(_d.formToObject(formNode), prettyPrint); // String
- }
+ };
dojo.queryToObject = function(/*String*/ str){
// summary:
@@ -179,7 +180,7 @@ dojo.require("dojo._base.query");
// This string:
//
// | "foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
- //
+ //
// results in this object structure:
//
// | {
@@ -187,7 +188,7 @@ dojo.require("dojo._base.query");
// | thinger: " spaces =blah",
// | zonk: "blarg"
// | }
- //
+ //
// Note that spaces and other urlencoded entities are correctly
// handled.
@@ -212,7 +213,7 @@ dojo.require("dojo._base.query");
}
});
return ret; // Object
- }
+ };
// need to block async callbacks from snatching this thread as the result
// of an async callback might call another sync XHR, this hangs khtml forever
@@ -222,7 +223,7 @@ dojo.require("dojo._base.query");
// MOW: remove dojo._contentHandlers alias in 2.0
var handlers = _d._contentHandlers = dojo.contentHandlers = {
- // summary:
+ // summary:
// A map of availble XHR transport handle types. Name matches the
// `handleAs` attribute passed to XHR calls.
//
@@ -230,41 +231,41 @@ dojo.require("dojo._base.query");
// A map of availble XHR transport handle types. Name matches the
// `handleAs` attribute passed to XHR calls. Each contentHandler is
// called, passing the xhr object for manipulation. The return value
- // from the contentHandler will be passed to the `load` or `handle`
- // functions defined in the original xhr call.
- //
+ // from the contentHandler will be passed to the `load` or `handle`
+ // functions defined in the original xhr call.
+ //
// example:
// Creating a custom content-handler:
// | dojo.contentHandlers.makeCaps = function(xhr){
// | return xhr.responseText.toUpperCase();
// | }
// | // and later:
- // | dojo.xhrGet({
+ // | dojo.xhrGet({
// | url:"foo.txt",
// | handleAs:"makeCaps",
// | load: function(data){ /* data is a toUpper version of foo.txt */ }
// | });
- text: function(xhr){
+ text: function(xhr){
// summary: A contentHandler which simply returns the plaintext response data
- return xhr.responseText;
+ return xhr.responseText;
},
json: function(xhr){
// summary: A contentHandler which returns a JavaScript object created from the response data
return _d.fromJson(xhr.responseText || null);
},
- "json-comment-filtered": function(xhr){
- // summary: A contentHandler which expects comment-filtered JSON.
- // description:
- // A contentHandler which expects comment-filtered JSON.
+ "json-comment-filtered": function(xhr){
+ // summary: A contentHandler which expects comment-filtered JSON.
+ // description:
+ // A contentHandler which expects comment-filtered JSON.
// the json-comment-filtered option was implemented to prevent
// "JavaScript Hijacking", but it is less secure than standard JSON. Use
// standard JSON instead. JSON prefixing can be used to subvert hijacking.
- //
+ //
// Will throw a notice suggesting to use application/json mimetype, as
// json-commenting can introduce security issues. To decrease the chances of hijacking,
- // use the standard `json` contentHandler, and prefix your "JSON" with: {}&&
- //
+ // use the standard `json` contentHandler, and prefix your "JSON" with: {}&&
+ //
// use djConfig.useCommentedJson = true to turn off the notice
if(!dojo.config.useCommentedJson){
console.warn("Consider using the standard mimetype:application/json."
@@ -282,7 +283,7 @@ dojo.require("dojo._base.query");
}
return _d.fromJson(value.substring(cStartIdx+2, cEndIdx));
},
- javascript: function(xhr){
+ javascript: function(xhr){
// summary: A contentHandler which evaluates the response data, expecting it to be valid JavaScript
// FIXME: try Moz and IE specific eval variants?
@@ -294,7 +295,7 @@ dojo.require("dojo._base.query");
if(_d.isIE && (!result || !result.documentElement)){
//WARNING: this branch used by the xml handling in dojo.io.iframe,
//so be sure to test dojo.io.iframe if making changes below.
- var ms = function(n){ return "MSXML" + n + ".DOMDocument"; }
+ var ms = function(n){ return "MSXML" + n + ".DOMDocument"; };
var dp = ["Microsoft.XMLDOM", ms(6), ms(4), ms(3), ms(2)];
_d.some(dp, function(p){
try{
@@ -309,7 +310,7 @@ dojo.require("dojo._base.query");
return result; // DOMDocument
},
"json-comment-optional": function(xhr){
- // summary: A contentHandler which checks the presence of comment-filtered JSON and
+ // summary: A contentHandler which checks the presence of comment-filtered JSON and
// alternates between the `json` and `json-comment-filtered` contentHandlers.
if(xhr.responseText && /^[^{\[]*\/\*/.test(xhr.responseText)){
return handlers["json-comment-filtered"](xhr);
@@ -341,7 +342,7 @@ dojo.require("dojo._base.query");
// handleAs: String?
// Acceptable values depend on the type of IO
// transport (see specific IO calls for more information).
- // rawBody: String?
+ // rawBody: String?
// Sets the raw body for an HTTP request. If this is used, then the content
// property is ignored. This is mostly useful for HTTP methods that have
// a body to their requests, like PUT or POST. This property can be used instead
@@ -486,7 +487,7 @@ dojo.require("dojo._base.query");
/*Function*/canceller,
/*Function*/okHandler,
/*Function*/errHandler){
- // summary:
+ // summary:
// sets up the Deferred and ioArgs property on the Deferred so it
// can be used in an io call.
// args:
@@ -502,19 +503,19 @@ dojo.require("dojo._base.query");
// object returned from this function.
// errHandler:
// The first error callback to be registered with Deferred. It has the opportunity
- // to do cleanup on an error. It will receive two arguments: error (the
+ // to do cleanup on an error. It will receive two arguments: error (the
// Error object) and dfd, the Deferred object returned from this function.
var ioArgs = {args: args, url: args.url};
//Get values from form if requestd.
var formObject = null;
- if(args.form){
+ if(args.form){
var form = _d.byId(args.form);
- //IE requires going through getAttributeNode instead of just getAttribute in some form cases,
+ //IE requires going through getAttributeNode instead of just getAttribute in some form cases,
//so use it for all. See #2844
var actnNode = form.getAttributeNode("action");
- ioArgs.url = ioArgs.url || (actnNode ? actnNode.value : null);
+ ioArgs.url = ioArgs.url || (actnNode ? actnNode.value : null);
formObject = _d.formToObject(form);
}
@@ -587,7 +588,7 @@ dojo.require("dojo._base.query");
// FIXME: need to wire up the xhr object's abort method to something
// analagous in the Deferred
return d;
- }
+ };
var _deferredCancel = function(/*Deferred*/dfd){
// summary: canceller function for dojo._ioSetArgs call.
@@ -604,13 +605,13 @@ dojo.require("dojo._base.query");
err.dojoType="cancel";
}
return err;
- }
+ };
var _deferredOk = function(/*Deferred*/dfd){
// summary: okHandler function for dojo._ioSetArgs call.
var ret = handlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr);
return ret === undefined ? null : ret;
- }
+ };
var _deferError = function(/*Error*/error, /*Deferred*/dfd){
// summary: errHandler function for dojo._ioSetArgs call.
@@ -618,7 +619,7 @@ dojo.require("dojo._base.query");
console.error(error);
}
return error;
- }
+ };
// avoid setting a timer per request. It degrades performance on IE
// something fierece if we don't use unified loops.
@@ -642,7 +643,7 @@ dojo.require("dojo._base.query");
};
var _watchInFlight = function(){
- //summary:
+ //summary:
// internal method that checks each inflight XMLHttpRequest to see
// if it has completed or if the timeout situation applies.
@@ -657,7 +658,7 @@ dojo.require("dojo._base.query");
var dfd = tif.dfd;
var func = function(){
if(!dfd || dfd.canceled || !tif.validCheck(dfd)){
- _inFlight.splice(i--, 1);
+ _inFlight.splice(i--, 1);
_pubCount -= 1;
}else if(tif.ioCheck(dfd)){
_inFlight.splice(i--, 1);
@@ -695,7 +696,7 @@ dojo.require("dojo._base.query");
_inFlightIntvl = null;
return;
}
- }
+ };
dojo._ioCancelAll = function(){
//summary: Cancels all pending IO requests, regardless of IO type
@@ -707,7 +708,7 @@ dojo.require("dojo._base.query");
}catch(e){/*squelch*/}
});
}catch(e){/*squelch*/}
- }
+ };
//Automatically call cancel all io calls on unload
//in IE for trac issue #2357.
@@ -730,10 +731,10 @@ dojo.require("dojo._base.query");
_pubCount += 1;
_d.publish("/dojo/io/send", [dfd]);
}
- }
+ };
_d._ioWatch = function(dfd, validCheck, ioCheck, resHandle){
- // summary:
+ // summary:
// Watches the io request represented by dfd to see if it completes.
// dfd: Deferred
// The Deferred object to watch.
@@ -763,16 +764,16 @@ dojo.require("dojo._base.query");
if(args.sync){
_watchInFlight();
}
- }
+ };
var _defaultContentType = "application/x-www-form-urlencoded";
var _validCheck = function(/*Deferred*/dfd){
return dfd.ioArgs.xhr.readyState; //boolean
- }
+ };
var _ioCheck = function(/*Deferred*/dfd){
return 4 == dfd.ioArgs.xhr.readyState; //boolean
- }
+ };
var _resHandle = function(/*Deferred*/dfd){
var xhr = dfd.ioArgs.xhr;
if(_d._isDocumentOk(xhr)){
@@ -783,7 +784,7 @@ dojo.require("dojo._base.query");
err.responseText = xhr.responseText;
dfd.errback(err);
}
- }
+ };
dojo._ioAddQueryToUrl = function(/*dojo.__IoCallbackArgs*/ioArgs){
//summary: Adds query params discovered by the io deferred construction to the URL.
@@ -791,8 +792,8 @@ dojo.require("dojo._base.query");
if(ioArgs.query.length){
ioArgs.url += (ioArgs.url.indexOf("?") == -1 ? "?" : "&") + ioArgs.query;
ioArgs.query = null;
- }
- }
+ }
+ };
/*=====
dojo.declare("dojo.__XhrArgs", dojo.__IoArgs, {
@@ -893,13 +894,13 @@ dojo.require("dojo._base.query");
_d._ioWatch(dfd, _validCheck, _ioCheck, _resHandle);
xhr = null;
return dfd; // dojo.Deferred
- }
+ };
dojo.xhrGet = function(/*dojo.__XhrArgs*/ args){
- // summary:
+ // summary:
// Sends an HTTP GET request to the server.
return _d.xhr("GET", args); // dojo.Deferred
- }
+ };
dojo.rawXhrPost = dojo.xhrPost = function(/*dojo.__XhrArgs*/ args){
// summary:
@@ -908,7 +909,7 @@ dojo.require("dojo._base.query");
// postData:
// String. Send raw data in the body of the POST request.
return _d.xhr("POST", args, true); // dojo.Deferred
- }
+ };
dojo.rawXhrPut = dojo.xhrPut = function(/*dojo.__XhrArgs*/ args){
// summary:
@@ -917,13 +918,13 @@ dojo.require("dojo._base.query");
// putData:
// String. Send raw data in the body of the PUT request.
return _d.xhr("PUT", args, true); // dojo.Deferred
- }
+ };
dojo.xhrDelete = function(/*dojo.__XhrArgs*/ args){
// summary:
// Sends an HTTP DELETE request to the server.
return _d.xhr("DELETE", args); //dojo.Deferred
- }
+ };
/*
dojo.wrapForm = function(formNode){