]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dojo/dojo.js.uncompressed.js
upgrade Dojo to 1.6.1
[tt-rss.git] / lib / dojo / dojo.js.uncompressed.js
index 07593d88e017059fabfc11b13fdfddafda3e8091..af7051aaf3d5a13e3103653cbbadf3c138ee2db7 100644 (file)
@@ -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
 */
@@ -122,7 +122,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
@@ -149,7 +149,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.
@@ -195,7 +195,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(){
@@ -255,9 +255,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];
                }
        }
 
@@ -269,7 +273,7 @@ dojo.global = {
 =====*/
        dojo.locale = d.config.locale;
 
-       var rev = "$Rev: 22487 $".match(/\d+/);
+       var rev = "$Rev: 24595 $".match(/\d+/);
 
 /*=====
        dojo.version = function(){
@@ -293,7 +297,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){
@@ -369,7 +373,7 @@ dojo.global = {
                //      |               constructor: function(properties){
                //      |                       // property configuration:
                //      |                       dojo.mixin(this, properties);
-               //      |       
+               //      |
                //      |                       console.log(this.quip);
                //      |                       //  ...
                //      |               },
@@ -390,7 +394,7 @@ dojo.global = {
                //      |                       name: "Carl Brutanananadilewski"
                //      |               }
                //      |       );
-               //      |       
+               //      |
                //      |       // will print "Carl Brutanananadilewski"
                //      |       console.log(flattened.name);
                //      |       // will print "true"
@@ -465,10 +469,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:
@@ -487,7 +488,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){
@@ -553,9 +554,8 @@ dojo.global = {
  * 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: {},
@@ -587,11 +587,11 @@ dojo.global = {
 
                _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: [],
@@ -610,21 +610,24 @@ dojo.global = {
                //              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;
                }
        }
 
@@ -637,7 +640,7 @@ dojo.global = {
                //              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
@@ -651,7 +654,8 @@ dojo.global = {
                        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.
@@ -663,16 +667,16 @@ dojo.global = {
                }
                // 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);
@@ -695,10 +699,10 @@ dojo.global = {
        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;
@@ -725,8 +729,8 @@ dojo.global = {
        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){
@@ -745,13 +749,13 @@ dojo.global = {
 
        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
@@ -794,7 +798,7 @@ dojo.global = {
 
        dojo._modulesLoaded = function(){
                if(d._postLoad){ return; }
-               if(d._inFlightCount > 0){ 
+               if(d._inFlightCount > 0){
                        console.warn("files still in flight!");
                        return;
                }
@@ -826,8 +830,8 @@ dojo.global = {
                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);
@@ -862,87 +866,95 @@ dojo.global = {
        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.
@@ -953,10 +965,8 @@ dojo.global = {
 
                // 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 + "'");
                }
@@ -967,7 +977,7 @@ dojo.global = {
                        // 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 + "'");
                        }
                }
 
@@ -988,14 +998,14 @@ dojo.global = {
                //              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
@@ -1004,11 +1014,11 @@ dojo.global = {
                //              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 + "";
@@ -1065,7 +1075,7 @@ dojo.global = {
                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);
@@ -1075,13 +1085,13 @@ dojo.global = {
        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
@@ -1094,7 +1104,7 @@ dojo.global = {
                //              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");
@@ -1103,8 +1113,8 @@ dojo.global = {
                //      |               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
@@ -1115,7 +1125,7 @@ dojo.global = {
                // 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.
@@ -1130,21 +1140,21 @@ dojo.global = {
                //              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.
                //
@@ -1186,11 +1196,11 @@ dojo.global = {
                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:
@@ -1257,7 +1267,7 @@ dojo.global = {
                        }
 
                        uri = [];
-                       if(relobj.scheme){ 
+                       if(relobj.scheme){
                                uri.push(relobj.scheme, ":");
                        }
                        if(relobj.authority){
@@ -1297,7 +1307,7 @@ dojo.global = {
        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");
@@ -1305,10 +1315,10 @@ dojo.global = {
                //      |       // 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,
@@ -1319,9 +1329,9 @@ dojo.global = {
                //      |       // 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");
@@ -1340,7 +1350,10 @@ dojo.global = {
                }
 
                return new d._Url(loc, url); // dojo._Url
-       }
+       };
+
+
+
 })();
 
 /*=====
@@ -1364,9 +1377,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.
        //      |       }
 };
@@ -1409,7 +1422,6 @@ dojo = {
        //              True if the client runs on Mac
 }
 =====*/
-
 if(typeof window != 'undefined'){
        dojo.isBrowser = true;
        dojo._name = "browser";
@@ -1436,7 +1448,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){
@@ -1510,7 +1522,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){
@@ -1543,10 +1555,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.
@@ -1641,7 +1654,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
@@ -1672,7 +1685,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
@@ -1685,7 +1698,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")
@@ -1722,7 +1735,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
@@ -1739,10 +1752,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){
@@ -1805,16 +1818,20 @@ 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");
 }
 
+
 if(!dojo._hasResource["dojo._base.lang"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
 dojo._hasResource["dojo._base.lang"] = true;
 dojo.provide("dojo._base.lang");
 
+
 (function(){
        var d = dojo, opts = Object.prototype.toString;
 
@@ -1824,14 +1841,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:
@@ -1845,7 +1862,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:
@@ -1864,14 +1881,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:
@@ -1882,7 +1899,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);
@@ -1894,8 +1911,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:
@@ -1903,7 +1920,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.
@@ -1943,7 +1960,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){
@@ -1987,7 +2004,7 @@ dojo.provide("dojo._base.lang");
                                d._mixin(tmp, props);
                        }
                        return tmp; // Object
-               }
+               };
        })();
 
        /*=====
@@ -2036,7 +2053,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 = {};
 
@@ -2056,6 +2073,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
@@ -2094,7 +2115,7 @@ dojo.provide("dojo._base.lang");
                        }
                }
                                return r; // Object
-       }
+       };
 
        /*=====
        dojo.trim = function(str){
@@ -2123,7 +2144,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
@@ -2199,13 +2220,14 @@ dojo.provide("dojo._base.lang");
 
 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.provide("dojo._base.array");
 
+
+
 (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
@@ -2224,7 +2246,7 @@ dojo.provide("dojo._base.array");
        };
 
        dojo.mixin(dojo, {
-               indexOf: function(      /*Array*/               array, 
+               indexOf: function(      /*Array*/               array,
                                                        /*Object*/              value,
                                                        /*Integer?*/    fromIndex,
                                                        /*Boolean?*/    findLast){
@@ -2233,7 +2255,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
@@ -2258,7 +2280,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
@@ -2277,7 +2299,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:
@@ -2300,21 +2322,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 ],
@@ -2327,7 +2349,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);
                        }
                },
@@ -2344,7 +2366,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:
@@ -2353,7 +2375,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
                },
@@ -2370,7 +2392,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:
@@ -2397,7 +2419,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:
@@ -2428,9 +2450,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:
@@ -2464,10 +2486,10 @@ dojo.provide("dojo._base.declare");
        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;
 
@@ -2475,9 +2497,9 @@ dojo.provide("dojo._base.declare");
                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;
@@ -2530,7 +2552,7 @@ dojo.provide("dojo._base.declare");
                        }
                }
                if(clsCount){
-                       err("can't build consistent linearization");
+                       err("can't build consistent linearization", className);
                }
 
                // calculate the superclass offset
@@ -2557,7 +2579,7 @@ dojo.provide("dojo._base.declare");
                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;
@@ -2575,7 +2597,7 @@ dojo.provide("dojo._base.declare");
                                        // 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{
@@ -2616,7 +2638,7 @@ dojo.provide("dojo._base.declare");
                                        // 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
@@ -2912,7 +2934,7 @@ dojo.provide("dojo._base.declare");
                // 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];
@@ -2923,10 +2945,10 @@ dojo.provide("dojo._base.declare");
                                        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){
@@ -3500,27 +3522,28 @@ dojo._hasResource["dojo._base.connect"] = true;
 dojo.provide("dojo._base.connect");
 
 
+
 // 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)){
@@ -3534,12 +3557,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];
@@ -3549,15 +3572,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.
@@ -3579,9 +3602,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:
@@ -3616,37 +3639,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:
@@ -3696,9 +3719,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:
@@ -3712,11 +3735,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
 
@@ -3734,15 +3757,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:
@@ -3752,7 +3775,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:
@@ -3760,11 +3783,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
@@ -3773,10 +3796,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
@@ -3785,11 +3808,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");
@@ -3804,42 +3827,43 @@ dojo._hasResource["dojo._base.Deferred"] = true;
 dojo.provide("dojo._base.Deferred");
 
 
+
 (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:
@@ -3849,7 +3873,7 @@ dojo.provide("dojo._base.Deferred");
        //                      * 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
@@ -3909,7 +3933,7 @@ dojo.provide("dojo._base.Deferred");
        //              |                               renderDataitem(data[x]);
        //              |                       }
        //              |                       d.callback(true);
-       //              |               }catch(e){ 
+       //              |               }catch(e){
        //              |                       d.errback(new Error("rendering failed"));
        //              |               }
        //              |               return d;
@@ -3923,7 +3947,7 @@ dojo.provide("dojo._base.Deferred");
        //              |       // 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:
        //
@@ -3936,7 +3960,7 @@ dojo.provide("dojo._base.Deferred");
        //              |                                       renderDataitem(data[x]);
        //              |                               }
        //              |                               d.callback(true);
-       //              |                       }catch(e){ 
+       //              |                       }catch(e){
        //              |                               d.errback(new Error("rendering failed"));
        //              |                       }
        //              |               }, 100);
@@ -3951,11 +3975,11 @@ dojo.provide("dojo._base.Deferred");
        //              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;
@@ -3966,7 +3990,7 @@ dojo.provide("dojo._base.Deferred");
                        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);
@@ -3978,6 +4002,9 @@ dojo.provide("dojo._base.Deferred");
                                                        continue;
                                                }
                                                var unchanged = mutated && newResult === undefined;
+                                               if(mutated && !unchanged){
+                                                       isError = newResult instanceof Error;
+                                               }
                                                listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
                                        }
                                        catch (e) {
@@ -3990,7 +4017,7 @@ dojo.provide("dojo._base.Deferred");
                                                listener.deferred.resolve(result);
                                        }
                                }
-                       }       
+                       }
                }
                // calling resolve will resolve the promise
                this.resolve = this.callback = function(value){
@@ -4005,7 +4032,7 @@ dojo.provide("dojo._base.Deferred");
                // 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);
@@ -4022,7 +4049,7 @@ dojo.provide("dojo._base.Deferred");
                        while(listener){
                                var progress = listener.progress;
                                progress && progress(update);
-                               listener = listener.next;       
+                               listener = listener.next;
                        }
                };
                this.addCallbacks = function(/*Function?*/callback, /*Function?*/errback){
@@ -4031,35 +4058,35 @@ dojo.provide("dojo._base.Deferred");
                };
                // 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;
                        }
@@ -4085,7 +4112,7 @@ dojo.provide("dojo._base.Deferred");
                                        deferred.reject(error);
                                }
                        }
-               }
+               };
                freeze(promise);
        };
        dojo.extend(dojo.Deferred, {
@@ -4106,7 +4133,7 @@ dojo.provide("dojo._base.Deferred");
 })();
 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){
@@ -4139,6 +4166,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.
@@ -4146,12 +4174,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:
@@ -4161,7 +4189,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){
@@ -4205,8 +4233,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;
@@ -4279,7 +4307,7 @@ dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _ind
                output.push(newLine + nextIndent + keyStr + ":" + sep + val);
        }
        return "{" + output.join("," + sep) + newLine + _indentStr + "}"; // String
-}
+};
 
 }
 
@@ -4289,6 +4317,7 @@ dojo.provide("dojo._base.Color");
 
 
 
+
 (function(){
 
        var d = dojo;
@@ -4477,7 +4506,7 @@ dojo.provide("dojo._base.Color");
                //              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();
@@ -4502,26 +4531,13 @@ dojo.provide("dojo._base.Color");
        };
 })();
 
-}
-
-if(!dojo._hasResource["dojo._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo._base"] = true;
-dojo.provide("dojo._base");
-
-
-
-
-
-
-
-
-
 }
 
 if(!dojo._hasResource["dojo._base.window"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
 dojo._hasResource["dojo._base.window"] = true;
 dojo.provide("dojo._base.window");
 
+
 /*=====
 dojo.doc = {
        // summary:
@@ -4547,7 +4563,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:
@@ -4560,9 +4576,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
@@ -4581,11 +4597,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.
@@ -4616,7 +4632,6 @@ dojo.withDoc = function(  /*DocumentElement*/documentObject,
                dojo.isQuirks = oldQ;
        }
 };
-       
 
 }
 
@@ -4625,27 +4640,26 @@ dojo._hasResource["dojo._base.event"] = true;
 dojo.provide("dojo._base.event");
 
 
+
 // 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);
                                        }
                                }
                        }
@@ -4686,7 +4700,7 @@ dojo.provide("dojo._base.event");
                },
                _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":
@@ -4696,26 +4710,26 @@ dojo.provide("dojo._base.event");
                        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
                }
        });
 
@@ -4730,7 +4744,7 @@ dojo.provide("dojo._base.event");
                // sender: DOMNode
                //              node to treat as "currentTarget"
                return del._fixEvent(evt, sender);
-       }
+       };
 
        dojo.stopEvent = function(/*Event*/ evt){
                // summary:
@@ -4741,7 +4755,7 @@ dojo.provide("dojo._base.event");
                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;
@@ -4756,16 +4770,16 @@ dojo.provide("dojo._base.event");
                // 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
 
@@ -4895,7 +4909,7 @@ dojo.provide("dojo._base.event");
        };
 =====*/
 
-               if(dojo.isIE){
+               if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
                dojo.mouseButtons = {
                        LEFT:   1,
                        MIDDLE: 4,
@@ -4920,7 +4934,7 @@ dojo.provide("dojo._base.event");
                }
        
                // IE event normalization
-       if(dojo.isIE){ 
+       if(dojo.isIE){
                var _trySetKeyCode = function(e, code){
                        try{
                                // squelch errors when keyCode is read-only
@@ -4929,7 +4943,7 @@ dojo.provide("dojo._base.event");
                        }catch(e){
                                return 0;
                        }
-               }
+               };
 
                // by default, use the standard listener
                var iel = dojo._listener;
@@ -4938,7 +4952,7 @@ dojo.provide("dojo._base.event");
                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
@@ -4991,7 +5005,7 @@ dojo.provide("dojo._base.event");
                        },
                        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){
@@ -5017,11 +5031,11 @@ dojo.provide("dojo._base.event");
                                //              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
@@ -5034,14 +5048,16 @@ dojo.provide("dojo._base.event");
                                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){
@@ -5075,38 +5091,41 @@ dojo.provide("dojo._base.event");
                                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;
@@ -5116,23 +5135,23 @@ dojo.provide("dojo._base.event");
                });
                                
                // 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){
@@ -5183,12 +5202,12 @@ dojo.provide("dojo._base.event");
                                                        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
                                                                }
                                                        }
@@ -5245,25 +5264,26 @@ 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)); };
-       }
+       };
 }
 
 }
 
 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.provide("dojo._base.html");
 
+
+
 // FIXME: need to add unit tests for all the semi-public methods
 
 try{
@@ -5307,13 +5327,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;
@@ -5334,8 +5354,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
        };
 }
 /*=====
@@ -5418,16 +5439,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);
@@ -5510,7 +5531,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;
@@ -5545,7 +5566,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.
@@ -5557,7 +5578,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.
@@ -5577,10 +5598,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.
 
 /*=====
@@ -5619,7 +5640,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){
@@ -5680,7 +5701,7 @@ if(dojo.isIE || dojo.isOpera){
                                runtimeStyle.left = rsLeft;
                        }
                        return avalue;
-               }
+               };
        }
                var px = d._toPixelValue;
 
@@ -5708,7 +5729,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){
@@ -5735,7 +5756,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;
 
@@ -5807,7 +5828,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
@@ -5876,7 +5897,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
@@ -5889,13 +5910,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);
@@ -5905,7 +5926,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:
@@ -5919,7 +5940,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),
@@ -5930,7 +5951,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:
@@ -5944,7 +5965,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);
@@ -5954,7 +5975,7 @@ if(dojo.isIE || dojo.isOpera){
                        w: p.w + b.w,
                        h: p.h + b.h
                };
-       }
+       };
 
        dojo._getMarginExtents = function(n, computedStyle){
                //      summary:
@@ -5968,7 +5989,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),
@@ -5976,9 +5997,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;
@@ -5989,7 +6010,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
@@ -5997,10 +6018,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)
@@ -6044,9 +6065,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:
@@ -6075,7 +6110,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),
@@ -6088,7 +6123,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.
@@ -6099,12 +6134,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){
@@ -6130,14 +6165,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:
@@ -6152,7 +6187,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:
@@ -6164,7 +6199,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,
@@ -6196,7 +6231,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 };
 
@@ -6231,7 +6266,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:
@@ -6256,14 +6291,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"){
@@ -6279,19 +6314,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:
@@ -6312,7 +6347,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+
@@ -6337,18 +6372,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){
@@ -6366,10 +6405,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){
@@ -6386,60 +6424,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;
@@ -6447,7 +6432,7 @@ if(dojo.isIE || dojo.isOpera){
                }
 
                return ret; // Object
-       }
+       };
 
        dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){
                //      summary:
@@ -6469,7 +6454,7 @@ if(dojo.isIE || dojo.isOpera){
                mb.x = abs.x;
                mb.y = abs.y;
                return mb;
-       }
+       };
 
        // =============================
        // Element attribute Functions
@@ -6531,7 +6516,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",
@@ -6701,7 +6686,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:
@@ -6711,7 +6696,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:
@@ -6730,7 +6715,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:
@@ -6745,7 +6730,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
@@ -6783,7 +6768,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"];
@@ -6813,7 +6798,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){
@@ -6881,11 +6866,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){
@@ -6928,7 +6915,7 @@ if(dojo.isIE || dojo.isOpera){
                        df.appendChild(fc);
                }
                return df; // DOMNode
-       }
+       };
 
        // =============================
        // (CSS) Class Functions
@@ -6954,6 +6941,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){
@@ -7059,6 +7047,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.
@@ -7093,6 +7114,9 @@ dojo.provide("dojo._base.NodeList");
 
 
 
+
+
+
 (function(){
 
        var d = dojo;
@@ -7330,7 +7354,7 @@ dojo.provide("dojo._base.NodeList");
        });
 
        // 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]);
        });
 
@@ -7388,7 +7412,7 @@ dojo.provide("dojo._base.NodeList");
 
                _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);
@@ -7482,7 +7506,7 @@ dojo.provide("dojo._base.NodeList");
                        if(this._parent){
                                return this._parent;
                        }else{
-                               //Just return empy list.
+                               //Just return empty list.
                                return new this._NodeListCtor();
                        }
                },
@@ -7550,12 +7574,12 @@ dojo.provide("dojo._base.NodeList");
 
                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
@@ -7576,7 +7600,7 @@ dojo.provide("dojo._base.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.
                        // returns:
                        //              Positive Integer or 0 for a match, -1 of not found.
                        return d.lastIndexOf(this, value, fromIndex); // Integer
@@ -7654,12 +7678,12 @@ dojo.provide("dojo._base.NodeList");
 
                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
                },
 
                /*=====
@@ -7676,7 +7700,7 @@ dojo.provide("dojo._base.NodeList");
                        //      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
                },
@@ -7699,7 +7723,7 @@ dojo.provide("dojo._base.NodeList");
                        //              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
@@ -7764,7 +7788,7 @@ dojo.provide("dojo._base.NodeList");
                        //              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
@@ -7810,7 +7834,7 @@ dojo.provide("dojo._base.NodeList");
                        //              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:
@@ -7825,18 +7849,15 @@ dojo.provide("dojo._base.NodeList");
                        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){
@@ -7863,7 +7884,7 @@ dojo.provide("dojo._base.NodeList");
                // 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:
@@ -7874,9 +7895,9 @@ dojo.provide("dojo._base.NodeList");
                        //      |               </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:
@@ -7891,18 +7912,14 @@ dojo.provide("dojo._base.NodeList");
                        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){
@@ -7914,7 +7931,7 @@ dojo.provide("dojo._base.NodeList");
                        //              |       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
@@ -7962,10 +7979,10 @@ dojo.provide("dojo._base.NodeList");
                        //              |       "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
@@ -7996,7 +8013,7 @@ dojo.provide("dojo._base.NodeList");
                        //              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
@@ -8025,11 +8042,11 @@ dojo.provide("dojo._base.NodeList");
                        //      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:
@@ -8039,13 +8056,13 @@ dojo.provide("dojo._base.NodeList");
                        //      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);
@@ -8055,7 +8072,8 @@ dojo.provide("dojo._base.NodeList");
        });
 
        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"
@@ -8068,7 +8086,7 @@ dojo.provide("dojo._base.NodeList");
                        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) :
@@ -8099,12 +8117,7 @@ dojo.provide("dojo._base.NodeList");
 
 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");
-       
-       
-
-}
+(function(){
 
 /*
        dojo.query() architectural overview:
@@ -8138,7 +8151,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").
 
@@ -8146,7 +8159,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
@@ -8157,7 +8170,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
@@ -8188,7 +8201,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,
@@ -8197,16 +8210,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
@@ -8222,7 +8235,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
@@ -8230,12 +8243,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
@@ -8244,7 +8257,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
@@ -8299,9 +8312,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
@@ -8331,9 +8344,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);
                                */
                        }
@@ -8342,15 +8355,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;
@@ -8393,7 +8406,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){
@@ -8401,7 +8414,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{
@@ -8412,19 +8425,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);
@@ -8433,7 +8446,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){
@@ -8454,7 +8467,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
@@ -8468,15 +8481,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)
@@ -8496,7 +8509,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; }
 
@@ -8548,7 +8561,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;
@@ -8558,7 +8571,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"
@@ -8624,7 +8637,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 ){
@@ -8636,11 +8649,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
@@ -8671,7 +8684,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;
@@ -8702,7 +8715,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;
                        }
@@ -8762,7 +8775,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){
@@ -8776,7 +8789,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
@@ -8807,7 +8820,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|$)");
@@ -8845,7 +8858,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));
                                });
                        }
@@ -8853,7 +8866,7 @@ if(typeof dojo != "undefined"){
 
                if(!ff){
                        if(!("default" in ignores)){
-                               ff = yesman; 
+                               ff = yesman;
                        }
                }
                return ff;
@@ -8904,7 +8917,7 @@ if(typeof dojo != "undefined"){
                                        _simpleNodeTest(te) &&
                                        (!bag || _isUnique(te, bag)) &&
                                        (filterFunc(te, x))
-                               ){ 
+                               ){
                                        ret.push(te);
                                }
                        }
@@ -8946,7 +8959,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
@@ -8999,7 +9012,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
@@ -9009,8 +9022,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){
@@ -9025,9 +9038,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
                        ){
@@ -9193,8 +9206,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)
        );
 
@@ -9205,7 +9218,7 @@ if(typeof dojo != "undefined"){
 
        var qsa = "querySelectorAll";
        var qsaAvail = (
-               !!getDoc()[qsa] && 
+               !!getDoc()[qsa] &&
                // see #5832
                (!d.isSafari || (d.isSafari > 3.1) || is525 )
        );
@@ -9234,7 +9247,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.
@@ -9248,11 +9261,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)) &&
 
@@ -9265,11 +9278,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
@@ -9278,7 +9291,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{
@@ -9305,9 +9318,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
@@ -9337,7 +9350,7 @@ if(typeof dojo != "undefined"){
                }else{
                        return node.uniqueID;
                }
-       } : 
+       } :
        function(node){
                return (node._uid || (node._uid = ++_zipIdx));
        };
@@ -9346,7 +9359,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);
@@ -9358,7 +9371,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();
@@ -9377,7 +9390,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);
@@ -9385,7 +9398,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);
                                        }
                                }
@@ -9393,7 +9406,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;
@@ -9423,11 +9436,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
@@ -9448,14 +9461,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:
@@ -9464,10 +9477,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
@@ -9577,12 +9590,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.
@@ -9599,16 +9612,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");
+               
+               
+               defineQuery(this["queryPortability"]||this["acme"]||dojo);
+       }else{
+               defineQuery(this["queryPortability"]||this["acme"]||defineAcme());
+       }
+
+})();
 
 /*
 */
@@ -9623,6 +9718,7 @@ dojo.provide("dojo._base.xhr");
 
 
 
+
 (function(){
        var _d = dojo, cfg = _d.config;
 
@@ -9663,7 +9759,7 @@ dojo.provide("dojo._base.xhr");
                        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){
@@ -9677,7 +9773,7 @@ dojo.provide("dojo._base.xhr");
                        }
                }
                return ret; // Object
-       }
+       };
 
        dojo.formToObject = function(/*DOMNode||String*/ formNode){
                // summary:
@@ -9704,7 +9800,7 @@ dojo.provide("dojo._base.xhr");
                //              yields this object structure as the result of a call to
                //              formToObject():
                //
-               //              |       { 
+               //              |       {
                //              |               blah: "blah",
                //              |               multi: [
                //              |                       "thud",
@@ -9725,7 +9821,7 @@ dojo.provide("dojo._base.xhr");
                        }
                });
                return ret; // Object
-       }
+       };
 
        dojo.objectToQuery = function(/*Object*/ map){
                //      summary:
@@ -9734,7 +9830,7 @@ dojo.provide("dojo._base.xhr");
                //      example:
                //              this object:
                //
-               //              |       { 
+               //              |       {
                //              |               blah: "blah",
                //              |               multi: [
                //              |                       "thud",
@@ -9743,7 +9839,7 @@ dojo.provide("dojo._base.xhr");
                //              |       };
                //
                //      yields the following query string:
-               //      
+               //
                //      |       "blah=blah&multi=thud&multi=thonk"
 
                // FIXME: need to implement encodeAscii!!
@@ -9764,21 +9860,21 @@ dojo.provide("dojo._base.xhr");
                        }
                }
                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:
@@ -9789,7 +9885,7 @@ dojo.provide("dojo._base.xhr");
                //              This string:
                //
                //      |               "foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
-               //              
+               //
                //              results in this object structure:
                //
                //      |               {
@@ -9797,7 +9893,7 @@ dojo.provide("dojo._base.xhr");
                //      |                       thinger: " spaces =blah",
                //      |                       zonk: "blarg"
                //      |               }
-               //      
+               //
                //              Note that spaces and other urlencoded entities are correctly
                //              handled.
 
@@ -9822,7 +9918,7 @@ dojo.provide("dojo._base.xhr");
                        }
                });
                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
@@ -9832,7 +9928,7 @@ dojo.provide("dojo._base.xhr");
 
        // 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.
                //
@@ -9840,41 +9936,41 @@ dojo.provide("dojo._base.xhr");
                //              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."
@@ -9892,7 +9988,7 @@ dojo.provide("dojo._base.xhr");
                        }
                        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?
@@ -9904,7 +10000,7 @@ dojo.provide("dojo._base.xhr");
                                                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{
@@ -9919,7 +10015,7 @@ dojo.provide("dojo._base.xhr");
                                                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);
@@ -9951,7 +10047,7 @@ dojo.provide("dojo._base.xhr");
                //      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
@@ -10096,7 +10192,7 @@ dojo.provide("dojo._base.xhr");
                        /*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:
@@ -10112,19 +10208,19 @@ dojo.provide("dojo._base.xhr");
                //              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);
                }
 
@@ -10197,7 +10293,7 @@ dojo.provide("dojo._base.xhr");
                // 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.
@@ -10214,13 +10310,13 @@ dojo.provide("dojo._base.xhr");
                        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.
 
@@ -10228,7 +10324,7 @@ dojo.provide("dojo._base.xhr");
                        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.
@@ -10252,7 +10348,7 @@ dojo.provide("dojo._base.xhr");
        };
 
        var _watchInFlight = function(){
-               //summary: 
+               //summary:
                //              internal method that checks each inflight XMLHttpRequest to see
                //              if it has completed or if the timeout situation applies.
                
@@ -10267,7 +10363,7 @@ dojo.provide("dojo._base.xhr");
                                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);
@@ -10305,7 +10401,7 @@ dojo.provide("dojo._base.xhr");
                        _inFlightIntvl = null;
                        return;
                }
-       }
+       };
 
        dojo._ioCancelAll = function(){
                //summary: Cancels all pending IO requests, regardless of IO type
@@ -10317,7 +10413,7 @@ dojo.provide("dojo._base.xhr");
                                }catch(e){/*squelch*/}
                        });
                }catch(e){/*squelch*/}
-       }
+       };
 
        //Automatically call cancel all io calls on unload
        //in IE for trac issue #2357.
@@ -10340,10 +10436,10 @@ dojo.provide("dojo._base.xhr");
                        _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.
@@ -10373,16 +10469,16 @@ dojo.provide("dojo._base.xhr");
                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)){
@@ -10393,7 +10489,7 @@ dojo.provide("dojo._base.xhr");
                        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.
@@ -10401,8 +10497,8 @@ dojo.provide("dojo._base.xhr");
                if(ioArgs.query.length){
                        ioArgs.url += (ioArgs.url.indexOf("?") == -1 ? "?" : "&") + ioArgs.query;
                        ioArgs.query = null;
-               }               
-       }
+               }
+       };
 
        /*=====
        dojo.declare("dojo.__XhrArgs", dojo.__IoArgs, {
@@ -10503,13 +10599,13 @@ dojo.provide("dojo._base.xhr");
                _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:
@@ -10518,7 +10614,7 @@ dojo.provide("dojo._base.xhr");
                //      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:
@@ -10527,13 +10623,13 @@ dojo.provide("dojo._base.xhr");
                //      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){
@@ -10558,6 +10654,7 @@ dojo.provide("dojo._base.fx");
 
 
 
+
 /*
        Animation loosely package based on Dan Pupius' work, contributed under CLA:
                http://pupius.co.uk/js/Toolkit.Drawing.js
@@ -11225,14 +11322,29 @@ dojo.provide("dojo._base.browser");
 
 
 
+       //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);
+       });
+
+}
+
+if(!dojo._hasResource["dojo._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base"] = true;
+dojo.provide("dojo._base");
+
+
+
+
+
+
+
+
+
 
-//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);
-});
 
 }