From 81bea17aefb26859f825b9293c7c99192874806e Mon Sep 17 00:00:00 2001
From: Andrew Dolgov
Date: Tue, 8 Nov 2011 20:40:44 +0400
Subject: upgrade Dojo to 1.6.1
---
lib/dojo/AdapterRegistry.js | 7 +-
lib/dojo/DeferredList.js | 6 +-
lib/dojo/LICENSE | 2 +-
lib/dojo/NodeList-data.js | 175 +
lib/dojo/NodeList-fx.js | 35 +-
lib/dojo/NodeList-html.js | 13 +-
lib/dojo/NodeList-manipulate.js | 21 +-
lib/dojo/NodeList-traverse.js | 33 +-
lib/dojo/OpenAjax.js | 42 +-
lib/dojo/Stateful.js | 35 +-
lib/dojo/_base.js | 6 +-
lib/dojo/_base/Color.js | 5 +-
lib/dojo/_base/Deferred.js | 106 +-
lib/dojo/_base/NodeList.js | 83 +-
lib/dojo/_base/_loader/bootstrap.js | 33 +-
lib/dojo/_base/_loader/hostenv_browser.js | 37 +-
lib/dojo/_base/_loader/hostenv_ff_ext.js | 6 +-
lib/dojo/_base/_loader/hostenv_rhino.js | 20 +-
lib/dojo/_base/_loader/hostenv_spidermonkey.js | 22 +-
lib/dojo/_base/_loader/loader.js | 176 +-
lib/dojo/_base/_loader/loader_debug.js | 2 +-
lib/dojo/_base/_loader/loader_xd.js | 40 +-
lib/dojo/_base/array.js | 39 +-
lib/dojo/_base/browser.js | 17 +-
lib/dojo/_base/connect.js | 93 +-
lib/dojo/_base/declare.js | 26 +-
lib/dojo/_base/event.js | 124 +-
lib/dojo/_base/fx.js | 3 +-
lib/dojo/_base/html.js | 266 +-
lib/dojo/_base/json.js | 15 +-
lib/dojo/_base/lang.js | 35 +-
lib/dojo/_base/query-sizzle.js | 32 +-
lib/dojo/_base/query.js | 261 +-
lib/dojo/_base/window.js | 20 +-
lib/dojo/_base/xhr.js | 117 +-
lib/dojo/_firebug/firebug.js | 108 +-
lib/dojo/back.js | 65 +-
lib/dojo/behavior.js | 89 +-
lib/dojo/build.txt | 7 +-
lib/dojo/cache.js | 11 +-
lib/dojo/cldr/monetary.js | 4 +-
lib/dojo/cldr/nls/ar/buddhist.js | 1 +
lib/dojo/cldr/nls/ar/gregorian.js | 2 +-
lib/dojo/cldr/nls/ar/number.js | 2 +-
lib/dojo/cldr/nls/ca/number.js | 2 +-
lib/dojo/cldr/nls/cs/gregorian.js | 2 +-
lib/dojo/cldr/nls/cs/number.js | 2 +-
lib/dojo/cldr/nls/da/buddhist.js | 1 +
lib/dojo/cldr/nls/da/gregorian.js | 2 +-
lib/dojo/cldr/nls/da/islamic.js | 1 +
lib/dojo/cldr/nls/da/number.js | 2 +-
lib/dojo/cldr/nls/de/buddhist.js | 1 +
lib/dojo/cldr/nls/de/gregorian.js | 2 +-
lib/dojo/cldr/nls/de/islamic.js | 1 +
lib/dojo/cldr/nls/de/number.js | 2 +-
lib/dojo/cldr/nls/el/buddhist.js | 1 +
lib/dojo/cldr/nls/el/gregorian.js | 2 +-
lib/dojo/cldr/nls/el/hebrew.js | 1 +
lib/dojo/cldr/nls/el/number.js | 2 +-
lib/dojo/cldr/nls/en-au/currency.js | 2 +-
lib/dojo/cldr/nls/en-au/number.js | 2 +-
lib/dojo/cldr/nls/en-ca/currency.js | 2 +-
lib/dojo/cldr/nls/en-gb/buddhist.js | 1 +
lib/dojo/cldr/nls/en-gb/islamic.js | 1 +
lib/dojo/cldr/nls/en-gb/number.js | 2 +-
lib/dojo/cldr/nls/en/buddhist.js | 1 +
lib/dojo/cldr/nls/en/currency.js | 2 +-
lib/dojo/cldr/nls/en/islamic.js | 1 +
lib/dojo/cldr/nls/en/number.js | 2 +-
lib/dojo/cldr/nls/es/buddhist.js | 1 +
lib/dojo/cldr/nls/es/islamic.js | 1 +
lib/dojo/cldr/nls/es/number.js | 2 +-
lib/dojo/cldr/nls/fi/buddhist.js | 1 +
lib/dojo/cldr/nls/fi/gregorian.js | 2 +-
lib/dojo/cldr/nls/fi/hebrew.js | 1 +
lib/dojo/cldr/nls/fi/islamic.js | 1 +
lib/dojo/cldr/nls/fi/number.js | 2 +-
lib/dojo/cldr/nls/fr-ch/gregorian.js | 1 +
lib/dojo/cldr/nls/fr-ch/number.js | 1 +
lib/dojo/cldr/nls/fr/gregorian.js | 2 +-
lib/dojo/cldr/nls/fr/number.js | 2 +-
lib/dojo/cldr/nls/he/number.js | 2 +-
lib/dojo/cldr/nls/hu/gregorian.js | 2 +-
lib/dojo/cldr/nls/hu/number.js | 2 +-
lib/dojo/cldr/nls/it/gregorian.js | 2 +-
lib/dojo/cldr/nls/it/number.js | 2 +-
lib/dojo/cldr/nls/ja/gregorian.js | 2 +-
lib/dojo/cldr/nls/ja/number.js | 2 +-
lib/dojo/cldr/nls/ko/gregorian.js | 2 +-
lib/dojo/cldr/nls/ko/number.js | 2 +-
lib/dojo/cldr/nls/nb/gregorian.js | 2 +-
lib/dojo/cldr/nls/nb/number.js | 2 +-
lib/dojo/cldr/nls/nl/gregorian.js | 2 +-
lib/dojo/cldr/nls/nl/number.js | 2 +-
lib/dojo/cldr/nls/number.js | 2 +-
lib/dojo/cldr/nls/pl/gregorian.js | 2 +-
lib/dojo/cldr/nls/pl/number.js | 2 +-
lib/dojo/cldr/nls/pt-pt/gregorian.js | 2 +-
lib/dojo/cldr/nls/pt-pt/number.js | 2 +-
lib/dojo/cldr/nls/pt/number.js | 2 +-
lib/dojo/cldr/nls/ro/buddhist.js | 1 +
lib/dojo/cldr/nls/ro/currency.js | 1 +
lib/dojo/cldr/nls/ro/gregorian.js | 1 +
lib/dojo/cldr/nls/ro/number.js | 1 +
lib/dojo/cldr/nls/ru/gregorian.js | 2 +-
lib/dojo/cldr/nls/ru/number.js | 2 +-
lib/dojo/cldr/nls/sk/number.js | 2 +-
lib/dojo/cldr/nls/sl/gregorian.js | 2 +-
lib/dojo/cldr/nls/sl/number.js | 2 +-
lib/dojo/cldr/nls/sv/gregorian.js | 2 +-
lib/dojo/cldr/nls/sv/number.js | 2 +-
lib/dojo/cldr/nls/th/number.js | 2 +-
lib/dojo/cldr/nls/tr/number.js | 2 +-
lib/dojo/cldr/nls/zh-hant/buddhist.js | 1 +
lib/dojo/cldr/nls/zh-hant/currency.js | 1 +
lib/dojo/cldr/nls/zh-hant/gregorian.js | 1 +
lib/dojo/cldr/nls/zh-hant/islamic.js | 1 +
lib/dojo/cldr/nls/zh-hant/number.js | 1 +
lib/dojo/cldr/nls/zh-hk/currency.js | 1 +
lib/dojo/cldr/nls/zh-hk/gregorian.js | 1 +
lib/dojo/cldr/nls/zh-hk/number.js | 1 +
lib/dojo/cldr/nls/zh-tw/currency.js | 2 +-
lib/dojo/cldr/nls/zh-tw/gregorian.js | 2 +-
lib/dojo/cldr/nls/zh/gregorian.js | 2 +-
lib/dojo/cldr/nls/zh/number.js | 2 +-
lib/dojo/cldr/supplemental.js | 17 +-
lib/dojo/colors.js | 10 +-
lib/dojo/cookie.js | 16 +-
lib/dojo/currency.js | 15 +-
lib/dojo/data/ItemFileReadStore.js | 195 +-
lib/dojo/data/ItemFileWriteStore.js | 85 +-
lib/dojo/data/ObjectStore.js | 487 +
lib/dojo/data/api/Identity.js | 31 +-
lib/dojo/data/api/Notification.js | 33 +-
lib/dojo/data/api/Read.js | 161 +-
lib/dojo/data/api/Request.js | 13 +-
lib/dojo/data/api/Write.js | 41 +-
lib/dojo/data/util/filter.js | 10 +-
lib/dojo/data/util/simpleFetch.js | 26 +-
lib/dojo/data/util/sorter.js | 22 +-
lib/dojo/date.js | 14 +-
lib/dojo/date/locale.js | 51 +-
lib/dojo/date/stamp.js | 10 +-
lib/dojo/dnd/Avatar.js | 6 +-
lib/dojo/dnd/Container.js | 13 +-
lib/dojo/dnd/Manager.js | 20 +-
lib/dojo/dnd/Moveable.js | 29 +-
lib/dojo/dnd/Mover.js | 48 +-
lib/dojo/dnd/Selector.js | 4 +-
lib/dojo/dnd/Source.js | 8 +-
lib/dojo/dnd/TimedMoveable.js | 6 +-
lib/dojo/dnd/autoscroll.js | 32 +-
lib/dojo/dnd/common.js | 4 +-
lib/dojo/dnd/move.js | 112 +-
lib/dojo/dojo.js | 4 +-
lib/dojo/dojo.js.uncompressed.js | 1448 +--
lib/dojo/fx.js | 34 +-
lib/dojo/fx/Toggler.js | 15 +-
lib/dojo/fx/easing.js | 60 +-
lib/dojo/gears.js | 6 +-
lib/dojo/hash.js | 38 +-
lib/dojo/html.js | 101 +-
lib/dojo/i18n.js | 22 +-
lib/dojo/io/iframe.js | 70 +-
lib/dojo/io/script.js | 22 +-
lib/dojo/jaxer.js | 3 +-
lib/dojo/lib/backCompat.js | 283 +
lib/dojo/lib/kernel.js | 26 +
lib/dojo/lib/main-browser.js | 61 +
lib/dojo/lib/plugins/i18n.js | 94 +
lib/dojo/lib/plugins/text.js | 70 +
lib/dojo/nls/fi/colors.js | 2 +-
lib/dojo/nls/kk/colors.js | 1 +
lib/dojo/nls/pl/colors.js | 2 +-
lib/dojo/nls/pt-pt/colors.js | 2 +-
lib/dojo/nls/pt/colors.js | 2 +-
lib/dojo/nls/sl/colors.js | 2 +-
lib/dojo/nls/tt-rss-layer_ROOT.js | 2 +-
lib/dojo/nls/tt-rss-layer_ar.js | 2 +-
lib/dojo/nls/tt-rss-layer_ca.js | 2 +-
lib/dojo/nls/tt-rss-layer_cs.js | 2 +-
lib/dojo/nls/tt-rss-layer_da.js | 2 +-
lib/dojo/nls/tt-rss-layer_de-de.js | 2 +-
lib/dojo/nls/tt-rss-layer_de.js | 2 +-
lib/dojo/nls/tt-rss-layer_el.js | 2 +-
lib/dojo/nls/tt-rss-layer_en-gb.js | 2 +-
lib/dojo/nls/tt-rss-layer_en-us.js | 2 +-
lib/dojo/nls/tt-rss-layer_en.js | 2 +-
lib/dojo/nls/tt-rss-layer_es-es.js | 2 +-
lib/dojo/nls/tt-rss-layer_es.js | 2 +-
lib/dojo/nls/tt-rss-layer_fi-fi.js | 2 +-
lib/dojo/nls/tt-rss-layer_fi.js | 2 +-
lib/dojo/nls/tt-rss-layer_fr-fr.js | 2 +-
lib/dojo/nls/tt-rss-layer_fr.js | 2 +-
lib/dojo/nls/tt-rss-layer_he-il.js | 2 +-
lib/dojo/nls/tt-rss-layer_he.js | 2 +-
lib/dojo/nls/tt-rss-layer_hu.js | 2 +-
lib/dojo/nls/tt-rss-layer_it-it.js | 2 +-
lib/dojo/nls/tt-rss-layer_it.js | 2 +-
lib/dojo/nls/tt-rss-layer_ja-jp.js | 2 +-
lib/dojo/nls/tt-rss-layer_ja.js | 2 +-
lib/dojo/nls/tt-rss-layer_ko-kr.js | 2 +-
lib/dojo/nls/tt-rss-layer_ko.js | 2 +-
lib/dojo/nls/tt-rss-layer_nb.js | 2 +-
lib/dojo/nls/tt-rss-layer_nl-nl.js | 2 +-
lib/dojo/nls/tt-rss-layer_nl.js | 2 +-
lib/dojo/nls/tt-rss-layer_pl.js | 2 +-
lib/dojo/nls/tt-rss-layer_pt-br.js | 2 +-
lib/dojo/nls/tt-rss-layer_pt-pt.js | 2 +-
lib/dojo/nls/tt-rss-layer_pt.js | 2 +-
lib/dojo/nls/tt-rss-layer_ru.js | 2 +-
lib/dojo/nls/tt-rss-layer_sk.js | 2 +-
lib/dojo/nls/tt-rss-layer_sl.js | 2 +-
lib/dojo/nls/tt-rss-layer_sv.js | 2 +-
lib/dojo/nls/tt-rss-layer_th.js | 2 +-
lib/dojo/nls/tt-rss-layer_tr.js | 2 +-
lib/dojo/nls/tt-rss-layer_xx.js | 2 +-
lib/dojo/nls/tt-rss-layer_zh-cn.js | 2 +-
lib/dojo/nls/tt-rss-layer_zh-tw.js | 2 +-
lib/dojo/nls/tt-rss-layer_zh.js | 2 +-
lib/dojo/nls/zh/colors.js | 2 +-
lib/dojo/number.js | 32 +-
lib/dojo/package.json | 21 +
lib/dojo/parser.js | 302 +-
lib/dojo/regexp.js | 14 +-
lib/dojo/resources/_modules.js | 4 +-
lib/dojo/robot.js | 6 +-
lib/dojo/robotx.js | 77 +-
lib/dojo/rpc/JsonService.js | 5 +-
lib/dojo/rpc/JsonpService.js | 11 +-
lib/dojo/rpc/RpcService.js | 11 +-
lib/dojo/store/Cache.js | 152 +
lib/dojo/store/DataStore.js | 142 +
lib/dojo/store/JsonRest.js | 146 +
lib/dojo/store/Memory.js | 164 +
lib/dojo/store/Observable.js | 173 +
lib/dojo/store/README | 10 +
lib/dojo/store/api/Store.js | 304 +
lib/dojo/store/util/QueryResults.js | 67 +
lib/dojo/store/util/SimpleQueryEngine.js | 116 +
lib/dojo/string.js | 22 +-
lib/dojo/tt-rss-layer.js | 4 +-
lib/dojo/tt-rss-layer.js.uncompressed.js | 13100 ++++++++++++-----------
lib/dojo/uacss.js | 6 +-
lib/dojo/window.js | 18 +-
245 files changed, 12549 insertions(+), 8708 deletions(-)
create mode 100644 lib/dojo/NodeList-data.js
create mode 100644 lib/dojo/cldr/nls/ar/buddhist.js
create mode 100644 lib/dojo/cldr/nls/da/buddhist.js
create mode 100644 lib/dojo/cldr/nls/da/islamic.js
create mode 100644 lib/dojo/cldr/nls/de/buddhist.js
create mode 100644 lib/dojo/cldr/nls/de/islamic.js
create mode 100644 lib/dojo/cldr/nls/el/buddhist.js
create mode 100644 lib/dojo/cldr/nls/el/hebrew.js
create mode 100644 lib/dojo/cldr/nls/en-gb/buddhist.js
create mode 100644 lib/dojo/cldr/nls/en-gb/islamic.js
create mode 100644 lib/dojo/cldr/nls/en/buddhist.js
create mode 100644 lib/dojo/cldr/nls/en/islamic.js
create mode 100644 lib/dojo/cldr/nls/es/buddhist.js
create mode 100644 lib/dojo/cldr/nls/es/islamic.js
create mode 100644 lib/dojo/cldr/nls/fi/buddhist.js
create mode 100644 lib/dojo/cldr/nls/fi/hebrew.js
create mode 100644 lib/dojo/cldr/nls/fi/islamic.js
create mode 100644 lib/dojo/cldr/nls/fr-ch/gregorian.js
create mode 100644 lib/dojo/cldr/nls/fr-ch/number.js
create mode 100644 lib/dojo/cldr/nls/ro/buddhist.js
create mode 100644 lib/dojo/cldr/nls/ro/currency.js
create mode 100644 lib/dojo/cldr/nls/ro/gregorian.js
create mode 100644 lib/dojo/cldr/nls/ro/number.js
create mode 100644 lib/dojo/cldr/nls/zh-hant/buddhist.js
create mode 100644 lib/dojo/cldr/nls/zh-hant/currency.js
create mode 100644 lib/dojo/cldr/nls/zh-hant/gregorian.js
create mode 100644 lib/dojo/cldr/nls/zh-hant/islamic.js
create mode 100644 lib/dojo/cldr/nls/zh-hant/number.js
create mode 100644 lib/dojo/cldr/nls/zh-hk/currency.js
create mode 100644 lib/dojo/cldr/nls/zh-hk/gregorian.js
create mode 100644 lib/dojo/cldr/nls/zh-hk/number.js
create mode 100644 lib/dojo/data/ObjectStore.js
create mode 100644 lib/dojo/lib/backCompat.js
create mode 100644 lib/dojo/lib/kernel.js
create mode 100644 lib/dojo/lib/main-browser.js
create mode 100644 lib/dojo/lib/plugins/i18n.js
create mode 100644 lib/dojo/lib/plugins/text.js
create mode 100644 lib/dojo/nls/kk/colors.js
create mode 100644 lib/dojo/package.json
create mode 100644 lib/dojo/store/Cache.js
create mode 100644 lib/dojo/store/DataStore.js
create mode 100644 lib/dojo/store/JsonRest.js
create mode 100644 lib/dojo/store/Memory.js
create mode 100644 lib/dojo/store/Observable.js
create mode 100644 lib/dojo/store/README
create mode 100644 lib/dojo/store/api/Store.js
create mode 100644 lib/dojo/store/util/QueryResults.js
create mode 100644 lib/dojo/store/util/SimpleQueryEngine.js
(limited to 'lib/dojo')
diff --git a/lib/dojo/AdapterRegistry.js b/lib/dojo/AdapterRegistry.js
index bb6a60f41..1d688a3b1 100644
--- a/lib/dojo/AdapterRegistry.js
+++ b/lib/dojo/AdapterRegistry.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo.AdapterRegistry"]){ //_hasResource checks added by b
dojo._hasResource["dojo.AdapterRegistry"] = true;
dojo.provide("dojo.AdapterRegistry");
+
dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){
// summary:
// A registry to make contextual calling/searching easier.
@@ -40,11 +41,11 @@ dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){
this.pairs = [];
this.returnWrappers = returnWrappers || false; // Boolean
-}
+};
dojo.extend(dojo.AdapterRegistry, {
register: function(/*String*/ name, /*Function*/ check, /*Function*/ wrap, /*Boolean?*/ directReturn, /*Boolean?*/ override){
- // summary:
+ // summary:
// register a check function to determine if the wrap function or
// object gets selected
// name:
diff --git a/lib/dojo/DeferredList.js b/lib/dojo/DeferredList.js
index a8156aba2..afe6638a1 100644
--- a/lib/dojo/DeferredList.js
+++ b/lib/dojo/DeferredList.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -8,6 +8,8 @@
if(!dojo._hasResource["dojo.DeferredList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo.DeferredList"] = true;
dojo.provide("dojo.DeferredList");
+
+
dojo.DeferredList = function(/*Array*/ list, /*Boolean?*/ fireOnOneCallback, /*Boolean?*/ fireOnOneErrback, /*Boolean?*/ consumeErrors, /*Function?*/ canceller){
// summary:
// Provides event handling for a group of Deferred objects.
@@ -65,7 +67,7 @@ dojo.DeferredList = function(/*Array*/ list, /*Boolean?*/ fireOnOneCallback, /*B
dojo.DeferredList.prototype = new dojo.Deferred();
dojo.DeferredList.prototype.gatherResults= function(deferredList){
- // summary:
+ // summary:
// Gathers the results of the deferreds for packaging
// as the parameters to the Deferred Lists' callback
diff --git a/lib/dojo/LICENSE b/lib/dojo/LICENSE
index 4c93ded6b..aa6b39f8c 100644
--- a/lib/dojo/LICENSE
+++ b/lib/dojo/LICENSE
@@ -13,7 +13,7 @@ The text of the AFL and BSD licenses is reproduced below.
The "New" BSD License:
**********************
-Copyright (c) 2005-2010, The Dojo Foundation
+Copyright (c) 2005-2011, The Dojo Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/lib/dojo/NodeList-data.js b/lib/dojo/NodeList-data.js
new file mode 100644
index 000000000..0126448d2
--- /dev/null
+++ b/lib/dojo/NodeList-data.js
@@ -0,0 +1,175 @@
+/*
+ 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
+*/
+
+
+if(!dojo._hasResource["dojo.NodeList-data"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo.NodeList-data"] = true;
+dojo.provide("dojo.NodeList-data");
+
+(function(d){
+
+/*=====
+ dojo.NodeList.prototype.data = function(key, value){
+ // summary: stash or get some arbitrary data on/from these nodes.
+ //
+ // description:
+ // Stash or get some arbirtrary data on/from these nodes. This private _data function is
+ // exposed publicly on `dojo.NodeList`, eg: as the result of a `dojo.query` call.
+ // DIFFERS from jQuery.data in that when used as a getter, the entire list is ALWAYS
+ // returned. EVEN WHEN THE LIST IS length == 1.
+ //
+ // A single-node version of this function is provided as `dojo._nodeData`, which follows
+ // the same signature, though expects a String ID or DomNode reference in the first
+ // position, before key/value arguments.
+ //
+ // node: String|DomNode
+ // The node to associate data with
+ //
+ // key: Object?|String?
+ // If an object, act as a setter and iterate over said object setting data items as defined.
+ // If a string, and `value` present, set the data for defined `key` to `value`
+ // If a string, and `value` absent, act as a getter, returning the data associated with said `key`
+ //
+ // value: Anything?
+ // The value to set for said `key`, provided `key` is a string (and not an object)
+ //
+ // example:
+ // Set a key `bar` to some data, then retrieve it.
+ // | dojo.query(".foo").data("bar", "touched");
+ // | var touched = dojo.query(".foo").data("bar");
+ // | if(touched[0] == "touched"){ alert('win'); }
+ //
+ // example:
+ // Get all the data items for a given node.
+ // | var list = dojo.query(".foo").data();
+ // | var first = list[0];
+ //
+ // example:
+ // Set the data to a complex hash. Overwrites existing keys with new value
+ // | dojo.query(".foo").data({ bar:"baz", foo:"bar" });
+ // Then get some random key:
+ // | dojo.query(".foo").data("foo"); // returns [`bar`]
+ //
+ // returns: Object|Anything|Nothing
+ // When used as a setter via `dojo.NodeList`, a NodeList instance is returned
+ // for further chaning. When used as a getter via `dojo.NodeList` an ARRAY
+ // of items is returned. The items in the array correspond to the elements
+ // in the original list. This is true even when the list length is 1, eg:
+ // when looking up a node by ID (#foo)
+ };
+
+ dojo.NodeList.prototype.removeData = function(key){
+ // summary: Remove the data associated with these nodes.
+ // key: String?
+ // If ommitted, clean all data for this node.
+ // If passed, remove the data item found at `key`
+ };
+
+ dojo._nodeDataCache = {
+ // summary: An alias to the private dataCache for NodeList-data. NEVER USE THIS!
+ // This private is only exposed for the benefit of unit testing, and is
+ // removed during the build process.
+ };
+
+=====*/
+
+ var dataCache = {}, x = 0, dataattr = "data-dojo-dataid", nl = d.NodeList,
+ dopid = function(node){
+ // summary: Return a uniqueish ID for the passed node reference
+ var pid = d.attr(node, dataattr);
+ if(!pid){
+ pid = "pid" + (x++);
+ d.attr(node, dataattr, pid);
+ }
+ return pid;
+ }
+ ;
+
+
+ var dodata = d._nodeData = function(node, key, value){
+
+ var pid = dopid(node), r;
+ if(!dataCache[pid]){ dataCache[pid] = {}; }
+
+ // API discrepency: calling with only a node returns the whole object. $.data throws
+ if(arguments.length == 1){ r = dataCache[pid]; }
+ if(typeof key == "string"){
+ // either getter or setter, based on `value` presence
+ if(arguments.length > 2){
+ dataCache[pid][key] = value;
+ }else{
+ r = dataCache[pid][key];
+ }
+ }else{
+ // must be a setter, mix `value` into data hash
+ // API discrepency: using object as setter works here
+ r = d._mixin(dataCache[pid], key);
+ }
+
+ return r; // Object|Anything|Nothing
+ };
+
+ var removeData = d._removeNodeData = function(node, key){
+ // summary: Remove some data from this node
+ // node: String|DomNode
+ // The node reference to remove data from
+ // key: String?
+ // If omitted, remove all data in this dataset.
+ // If passed, remove only the passed `key` in the associated dataset
+ var pid = dopid(node);
+ if(dataCache[pid]){
+ if(key){
+ delete dataCache[pid][key];
+ }else{
+ delete dataCache[pid];
+ }
+ }
+ };
+
+ d._gcNodeData = function(){
+ // summary: super expensive: GC all data in the data for nodes that no longer exist in the dom.
+ // description:
+ // super expensive: GC all data in the data for nodes that no longer exist in the dom.
+ // MUCH safer to do this yourself, manually, on a per-node basis (via `NodeList.removeData()`)
+ // provided as a stop-gap for exceptionally large/complex applications with constantly changing
+ // content regions (eg: a dijit.layout.ContentPane with replacing data)
+ // There is NO automatic GC going on. If you dojo.destroy() a node, you should _removeNodeData
+ // prior to destruction.
+ var livePids = dojo.query("[" + dataattr + "]").map(dopid);
+ for(var i in dataCache){
+ if(dojo.indexOf(livePids, i) < 0){ delete dataCache[i]; }
+ }
+ };
+
+ // make nodeData and removeNodeData public on dojo.NodeList:
+ d.extend(nl, {
+ data: nl._adaptWithCondition(dodata, function(a){
+ return a.length === 0 || a.length == 1 && (typeof a[0] == "string");
+ }),
+ removeData: nl._adaptAsForEach(removeData)
+ });
+
+// TODO: this is the basic implemetation of adaptWithCondtionAndWhenMappedConsiderLength, for lack of a better API name
+// it conflicts with the the `dojo.NodeList` way: always always return an arrayLike thinger. Consider for 2.0:
+//
+// nl.prototype.data = function(key, value){
+// var a = arguments, r;
+// if(a.length === 0 || a.length == 1 && (typeof a[0] == "string")){
+// r = this.map(function(node){
+// return d._data(node, key);
+// });
+// if(r.length == 1){ r = r[0]; } // the offending line, and the diff on adaptWithCondition
+// }else{
+// r = this.forEach(function(node){
+// d._data(node, key, value);
+// });
+// }
+// return r; // dojo.NodeList|Array|SingleItem
+// };
+
+})(dojo);
+
+}
diff --git a/lib/dojo/NodeList-fx.js b/lib/dojo/NodeList-fx.js
index de2cc3255..b9ec76647 100644
--- a/lib/dojo/NodeList-fx.js
+++ b/lib/dojo/NodeList-fx.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,6 +10,7 @@ dojo._hasResource["dojo.NodeList-fx"] = true;
dojo.provide("dojo.NodeList-fx");
dojo.require("dojo.fx");
+
/*=====
dojo["NodeList-fx"] = {
// summary: Adds dojo.fx animation support to dojo.query()
@@ -25,7 +26,7 @@ dojo.extend(dojo.NodeList, {
dojo.mixin(tmpArgs, args);
return obj[method](tmpArgs);
})
- );
+ );
return args.auto ? a.play() && this : a; // dojo.Animation|dojo.NodeList
},
@@ -34,7 +35,7 @@ dojo.extend(dojo.NodeList, {
// wipe in all elements of this NodeList via `dojo.fx.wipeIn`
//
// args: Object?
- // Additional dojo.Animation arguments to mix into this set with the addition of
+ // Additional dojo.Animation arguments to mix into this set with the addition of
// an `auto` parameter.
//
// returns: dojo.Animation|dojo.NodeList
@@ -58,7 +59,7 @@ dojo.extend(dojo.NodeList, {
// wipe out all elements of this NodeList via `dojo.fx.wipeOut`
//
// args: Object?
- // Additional dojo.Animation arguments to mix into this set with the addition of
+ // Additional dojo.Animation arguments to mix into this set with the addition of
// an `auto` parameter.
//
// returns: dojo.Animation|dojo.NodeList
@@ -77,7 +78,7 @@ dojo.extend(dojo.NodeList, {
// slide all elements of the node list to the specified place via `dojo.fx.slideTo`
//
// args: Object?
- // Additional dojo.Animation arguments to mix into this set with the addition of
+ // Additional dojo.Animation arguments to mix into this set with the addition of
// an `auto` parameter.
//
// returns: dojo.Animation|dojo.NodeList
@@ -100,7 +101,7 @@ dojo.extend(dojo.NodeList, {
// fade in all elements of this NodeList via `dojo.fadeIn`
//
// args: Object?
- // Additional dojo.Animation arguments to mix into this set with the addition of
+ // Additional dojo.Animation arguments to mix into this set with the addition of
// an `auto` parameter.
//
// returns: dojo.Animation|dojo.NodeList
@@ -119,7 +120,7 @@ dojo.extend(dojo.NodeList, {
// fade out all elements of this NodeList via `dojo.fadeOut`
//
// args: Object?
- // Additional dojo.Animation arguments to mix into this set with the addition of
+ // Additional dojo.Animation arguments to mix into this set with the addition of
// an `auto` parameter.
//
// returns: dojo.Animation|dojo.NodeList
@@ -155,14 +156,14 @@ dojo.extend(dojo.NodeList, {
// example:
// | dojo.query(".zork").animateProperty({
// | duration: 500,
- // | properties: {
+ // | properties: {
// | color: { start: "black", end: "white" },
- // | left: { end: 300 }
- // | }
+ // | left: { end: 300 }
+ // | }
// | }).play();
//
// example:
- // | dojo.query(".grue").animateProperty({
+ // | dojo.query(".grue").animateProperty({
// | auto:true,
// | properties: {
// | height:240
@@ -171,9 +172,9 @@ dojo.extend(dojo.NodeList, {
return this._anim(dojo, "animateProperty", args); // dojo.Animation|dojo.NodeList
},
- anim: function( /*Object*/ properties,
- /*Integer?*/ duration,
- /*Function?*/ easing,
+ anim: function( /*Object*/ properties,
+ /*Integer?*/ duration,
+ /*Function?*/ easing,
/*Function?*/ onEnd,
/*Integer?*/ delay){
// summary:
@@ -181,8 +182,8 @@ dojo.extend(dojo.NodeList, {
// The returned animation object will already be playing when it
// is returned. See the docs for `dojo.anim` for full details.
// properties: Object
- // the properties to animate. does NOT support the `auto` parameter like other
- // NodeList-fx methods.
+ // the properties to animate. does NOT support the `auto` parameter like other
+ // NodeList-fx methods.
// duration: Integer?
// Optional. The time to run the animations for
// easing: Function?
@@ -207,7 +208,7 @@ dojo.extend(dojo.NodeList, {
easing: easing
});
})
- );
+ );
if(onEnd){
dojo.connect(canim, "onEnd", onEnd);
}
diff --git a/lib/dojo/NodeList-html.js b/lib/dojo/NodeList-html.js
index e8e0ac220..bc8da9d86 100644
--- a/lib/dojo/NodeList-html.js
+++ b/lib/dojo/NodeList-html.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,6 +10,7 @@ dojo._hasResource["dojo.NodeList-html"] = true;
dojo.provide("dojo.NodeList-html");
dojo.require("dojo.html");
+
/*=====
dojo["NodeList-html"] = {
// summary: Adds a chainable html method to dojo.query() / Nodelist instances for setting/replacing node content
@@ -21,15 +22,15 @@ dojo.extend(dojo.NodeList, {
// summary:
// see `dojo.html.set()`. Set the content of all elements of this NodeList
//
- // description:
- // Based around `dojo.html.set()`, set the content of the Elements in a
+ // description:
+ // Based around `dojo.html.set()`, set the content of the Elements in a
// NodeList to the given content (string/node/nodelist), with optional arguments
// to further tune the set content behavior.
//
// example:
// | dojo.query(".thingList").html("
1
2
3
",
- // | {
- // | parseContent: true,
+ // | {
+ // | parseContent: true,
// | onBegin: function(){
// | this.content = this.content.replace(/([0-9])/g, this.id + ": $1");
// | this.inherited("onBegin", arguments);
@@ -38,7 +39,7 @@ dojo.extend(dojo.NodeList, {
var dhs = new dojo.html._ContentSetter(params || {});
this.forEach(function(elm){
- dhs.node = elm;
+ dhs.node = elm;
dhs.set(content);
dhs.tearDown();
});
diff --git a/lib/dojo/NodeList-manipulate.js b/lib/dojo/NodeList-manipulate.js
index 171540faf..8a4603843 100644
--- a/lib/dojo/NodeList-manipulate.js
+++ b/lib/dojo/NodeList-manipulate.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo.NodeList-manipulate"]){ //_hasResource checks added
dojo._hasResource["dojo.NodeList-manipulate"] = true;
dojo.provide("dojo.NodeList-manipulate");
+
/*=====
dojo["NodeList-manipulate"] = {
// summary: Adds a chainable methods to dojo.query() / Nodelist instances for manipulating HTML
@@ -51,7 +52,7 @@ dojo["NodeList-manipulate"] = {
}
function makeWrapNode(/*DOMNode||String*/html, /*DOMNode*/refNode){
- // summary:
+ // summary:
// convert HTML into nodes if it is not already a node.
if(typeof html == "string"){
html = dojo._toDom(html, (refNode && refNode.ownerDocument));
@@ -655,25 +656,25 @@ dojo["NodeList-manipulate"] = {
// example:
// assume a DOM created by this markup:
// |
- // |
___
+ // |
___
// |
Red One
- // |
___
+ // |
___
// |
Blue One
- // |
___
+ // |
___
// |
Red Two
- // |
___
+ // |
___
// |
Blue Two
// |
// Running this code:
// | dojo.query(".red").replaceAll(".blue");
// Results in this DOM structure:
// |
- // |
___
- // |
___
+ // |
___
+ // |
___
// |
Red One
// |
Red Two
- // |
___
- // |
___
+ // |
___
+ // |
___
// |
Red One
// |
Red Two
// |
diff --git a/lib/dojo/NodeList-traverse.js b/lib/dojo/NodeList-traverse.js
index b5314eed6..b6167ad0e 100644
--- a/lib/dojo/NodeList-traverse.js
+++ b/lib/dojo/NodeList-traverse.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo.NodeList-traverse"]){ //_hasResource checks added by
dojo._hasResource["dojo.NodeList-traverse"] = true;
dojo.provide("dojo.NodeList-traverse");
+
/*=====
dojo["NodeList-traverse"] = {
// summary: Adds a chainable methods to dojo.query() / Nodelist instances for traversing the DOM
@@ -28,18 +29,7 @@ dojo.extend(dojo.NodeList, {
ary = ary.concat(items);
}
}
- return ary;
- },
-
- _filterQueryResult: function(nodeList, query){
- // summmary:
- // Replacement for dojo._filterQueryResult that does a full
- // query. Slower, but allows for more types of queries.
- var filter = dojo.filter(nodeList, function(node){
- return dojo.query(query, node.parentNode).indexOf(node) != -1;
- });
- var result = this._wrap(filter);
- return result;
+ return ary;
},
_getUniqueAsNodeList: function(nodes){
@@ -65,7 +55,7 @@ dojo.extend(dojo.NodeList, {
// gets unique element nodes, filters them further
// with an optional query and then calls _stash to track parent NodeList.
var ary = this._getUniqueAsNodeList(nodes);
- ary = (query ? this._filterQueryResult(ary, query) : ary);
+ ary = (query ? dojo._filterQueryResult(ary, query) : ary);
return ary._stash(this); //dojo.NodeList
},
@@ -73,7 +63,7 @@ dojo.extend(dojo.NodeList, {
// summary:
// cycles over all the nodes and calls a callback
// to collect nodes for a possible inclusion in a result.
- // The callback will get two args: callback(node, ary),
+ // The callback will get two args: callback(node, ary),
// where ary is the array being used to collect the nodes.
return this._getUniqueNodeListWithParent(this._buildArrayFromCallback(callback), query); //dojo.NodeList
},
@@ -109,7 +99,7 @@ dojo.extend(dojo.NodeList, {
}); //dojo.NodeList
},
- closest: function(/*String*/query){
+ closest: function(/*String*/query, /*String|DOMNode?*/ root){
// summary:
// Returns closest parent that matches query, including current node in this
// dojo.NodeList if it matches the query.
@@ -118,6 +108,8 @@ dojo.extend(dojo.NodeList, {
// original dojo.NodeList.
// query:
// a CSS selector.
+ // root:
+ // If specified, query is relative to "root" rather than document body.
// returns:
// dojo.NodeList, the closest parent that matches the query, including the current
// node in this dojo.NodeList if it matches the query.
@@ -133,13 +125,12 @@ dojo.extend(dojo.NodeList, {
// Running this code:
// | dojo.query(".red").closest(".container");
// returns the div with class "container".
- var self = this;
- return this._getRelatedUniqueNodes(query, function(node, ary){
+ return this._getRelatedUniqueNodes(null, function(node, ary){
do{
- if(self._filterQueryResult([node], query).length){
+ if(dojo._filterQueryResult([node], query, root).length){
return node;
}
- }while((node = node.parentNode) && node.nodeType == 1);
+ }while(node != root && (node = node.parentNode) && node.nodeType == 1);
return null; //To make rhino strict checking happy.
}); //dojo.NodeList
},
@@ -461,7 +452,7 @@ dojo.extend(dojo.NodeList, {
// |
// Running this code:
// | dojo.query(".blue").last();
- // returns the last div with class "blue",
+ // returns the last div with class "blue",
return this._wrap((this.length ? [this[this.length - 1]] : []), this); //dojo.NodeList
},
diff --git a/lib/dojo/OpenAjax.js b/lib/dojo/OpenAjax.js
index c777f3ea8..f99af1a13 100644
--- a/lib/dojo/OpenAjax.js
+++ b/lib/dojo/OpenAjax.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,18 +9,18 @@
* OpenAjax.js
*
* Reference implementation of the OpenAjax Hub, as specified by OpenAjax Alliance.
- * Specification is under development at:
+ * Specification is under development at:
*
* http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification
*
* Copyright 2006-2007 OpenAjax Alliance
*
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless
- * required by applicable law or agreed to in writing, software distributed
- * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless
+ * required by applicable law or agreed to in writing, software distributed
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
******************************************************************************/
@@ -51,7 +51,7 @@ if(!window["OpenAjax"]){
prefix: prefix,
namespaceURI: nsURL,
version: version,
- extraData: extra
+ extraData: extra
};
this.publish(ooh+"registerLibrary", libs[prefix]);
}
@@ -82,7 +82,7 @@ if(!window["OpenAjax"]){
this._publish(this._subscriptions, path, 0, name, message);
this._pubDepth--;
if((this._cleanup.length > 0) && (this._pubDepth == 0)){
- for(var i = 0; i < this._cleanup.length; i++){
+ for(var i = 0; i < this._cleanup.length; i++){
this.unsubscribe(this._cleanup[i].hdl);
}
delete(this._cleanup);
@@ -100,12 +100,12 @@ if(!window["OpenAjax"]){
var token = path[index];
if(index == path.length){
tree.s.push(sub);
- }else{
+ }else{
if(typeof tree.c == "undefined"){
tree.c = {};
}
if(typeof tree.c[token] == "undefined"){
- tree.c[token] = { c: {}, s: [] };
+ tree.c[token] = { c: {}, s: [] };
this._subscribe(tree.c[token], path, index + 1, sub);
}else{
this._subscribe( tree.c[token], path, index + 1, sub);
@@ -120,7 +120,7 @@ if(!window["OpenAjax"]){
node = tree;
}else{
this._publish(tree.c[path[index]], path, index + 1, name, msg);
- this._publish(tree.c["*"], path, index + 1, name, msg);
+ this._publish(tree.c["*"], path, index + 1, name, msg);
node = tree.c["**"];
}
if(typeof node != "undefined"){
@@ -140,7 +140,7 @@ if(!window["OpenAjax"]){
// get a function object
fcb = sc[fcb];
}
- if((!fcb) ||
+ if((!fcb) ||
(fcb.call(sc, name, msg, d))) {
cb.call(sc, name, msg, d);
}
@@ -156,24 +156,24 @@ if(!window["OpenAjax"]){
var childNode = tree.c[path[index]];
this._unsubscribe(childNode, path, index + 1, sid);
if(childNode.s.length == 0) {
- for(var x in childNode.c)
- return;
- delete tree.c[path[index]];
+ for(var x in childNode.c)
+ return;
+ delete tree.c[path[index]];
}
return;
}
else {
var callbacks = tree.s;
var max = callbacks.length;
- for(var i = 0; i < max; i++)
+ for(var i = 0; i < max; i++)
if(sid == callbacks[i].sid) {
if(this._pubDepth > 0) {
- callbacks[i].cb = null;
- this._cleanup.push(callbacks[i]);
+ callbacks[i].cb = null;
+ this._cleanup.push(callbacks[i]);
}
else
callbacks.splice(i, 1);
- return;
+ return;
}
}
}
diff --git a/lib/dojo/Stateful.js b/lib/dojo/Stateful.js
index e4f406309..147001962 100644
--- a/lib/dojo/Stateful.js
+++ b/lib/dojo/Stateful.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo.Stateful"]){ //_hasResource checks added by build. D
dojo._hasResource["dojo.Stateful"] = true;
dojo.provide("dojo.Stateful");
+
dojo.declare("dojo.Stateful", null, {
// summary:
// Base class for objects that provide named properties with optional getter/setter
@@ -33,7 +34,7 @@ dojo.declare("dojo.Stateful", null, {
// description:
// Get a named property on a Stateful object. The property may
// potentially be retrieved via a getter method in subclasses. In the base class
- // this just retrieves the object's property.
+ // this just retrieves the object's property.
// For example:
// | stateful = new dojo.Stateful({foo: 3});
// | stateful.get("foo") // returns 3
@@ -45,11 +46,11 @@ dojo.declare("dojo.Stateful", null, {
// summary:
// Set a property on a Stateful instance
// name:
- // The property to set.
+ // The property to set.
// value:
// The value to set in the property.
// description:
- // Sets named properties on a stateful object and notifies any watchers of
+ // Sets named properties on a stateful object and notifies any watchers of
// the property. A programmatic setter may be defined in subclasses.
// For example:
// | stateful = new dojo.Stateful();
@@ -66,7 +67,7 @@ dojo.declare("dojo.Stateful", null, {
// This is equivalent to calling set(foo, "Howdy") and set(bar, 3)
if(typeof name === "object"){
for(var x in name){
- this.set(x, name[x]);
+ this.set(x, name[x]);
}
return this;
}
@@ -81,17 +82,17 @@ dojo.declare("dojo.Stateful", null, {
// summary:
// Watches a property for changes
// name:
- // Indicates the property to watch. This is optional (the callback may be the
+ // Indicates the property to watch. This is optional (the callback may be the
// only parameter), and if omitted, all the properties will be watched
// returns:
- // An object handle for the watch. The unwatch method of this object
+ // An object handle for the watch. The unwatch method of this object
// can be used to discontinue watching this property:
// | var watchHandle = obj.watch("foo", callback);
// | watchHandle.unwatch(); // callback won't be called now
// callback:
// The function to execute when the property changes. This will be called after
// the property has been changed. The callback will be called with the |this|
- // set to the instance, the first argument as the name of the property, the
+ // set to the instance, the first argument as the name of the property, the
// second argument as the old value and the third argument as the new value.
var callbacks = this._watchCallbacks;
@@ -99,15 +100,18 @@ dojo.declare("dojo.Stateful", null, {
var self = this;
callbacks = this._watchCallbacks = function(name, oldValue, value, ignoreCatchall){
var notify = function(propertyCallbacks){
- for(var i = 0, l = propertyCallbacks && propertyCallbacks.length; i < l; i++){
- try{
- propertyCallbacks[i].call(self, name, oldValue, value);
- }catch(e){
- console.error(e);
+ if(propertyCallbacks){
+ propertyCallbacks = propertyCallbacks.slice();
+ for(var i = 0, l = propertyCallbacks.length; i < l; i++){
+ try{
+ propertyCallbacks[i].call(self, name, oldValue, value);
+ }catch(e){
+ console.error(e);
+ }
}
}
};
- notify(callbacks[name]);
+ notify(callbacks['_' + name]);
if(!ignoreCatchall){
notify(callbacks["*"]); // the catch-all
}
@@ -116,6 +120,9 @@ dojo.declare("dojo.Stateful", null, {
if(!callback && typeof name === "function"){
callback = name;
name = "*";
+ }else{
+ // prepend with dash to prevent name conflicts with function (like "name" property)
+ name = '_' + name;
}
var propertyCallbacks = callbacks[name];
if(typeof propertyCallbacks !== "object"){
diff --git a/lib/dojo/_base.js b/lib/dojo/_base.js
index c77266788..78fc6064a 100644
--- a/lib/dojo/_base.js
+++ b/lib/dojo/_base.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -15,6 +15,8 @@ dojo.require("dojo._base.connect");
dojo.require("dojo._base.Deferred");
dojo.require("dojo._base.json");
dojo.require("dojo._base.Color");
-dojo.requireIf(dojo.isBrowser, "dojo._base.browser");
+dojo.require("dojo._base.browser");
+
+
}
diff --git a/lib/dojo/_base/Color.js b/lib/dojo/_base/Color.js
index 5f5c5af9b..4707fa582 100644
--- a/lib/dojo/_base/Color.js
+++ b/lib/dojo/_base/Color.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -11,6 +11,7 @@ dojo.provide("dojo._base.Color");
dojo.require("dojo._base.array");
dojo.require("dojo._base.lang");
+
(function(){
var d = dojo;
@@ -199,7 +200,7 @@ dojo.require("dojo._base.lang");
// Builds a `dojo.Color` from a 3 or 4 element array, mapping each
// element in sequence to the rgb(a) values of the color.
// example:
- // | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha
+ // | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha
// returns:
// A dojo.Color object. If obj is passed, it will be the return value.
var t = obj || new d.Color();
diff --git a/lib/dojo/_base/Deferred.js b/lib/dojo/_base/Deferred.js
index 3193024ab..c5992c966 100644
--- a/lib/dojo/_base/Deferred.js
+++ b/lib/dojo/_base/Deferred.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,42 +10,43 @@ dojo._hasResource["dojo._base.Deferred"] = true;
dojo.provide("dojo._base.Deferred");
dojo.require("dojo._base.lang");
+
(function(){
- var mutator = function(){};
+ var mutator = function(){};
var freeze = Object.freeze || function(){};
// A deferred provides an API for creating and resolving a promise.
dojo.Deferred = function(/*Function?*/canceller){
// summary:
// Deferreds provide a generic means for encapsulating an asynchronous
- // operation and notifying users of the completion and result of the operation.
+ // operation and notifying users of the completion and result of the operation.
// description:
// The dojo.Deferred API is based on the concept of promises that provide a
// generic interface into the eventual completion of an asynchronous action.
- // The motivation for promises fundamentally is about creating a
- // separation of concerns that allows one to achieve the same type of
- // call patterns and logical data flow in asynchronous code as can be
- // achieved in synchronous code. Promises allows one
- // to be able to call a function purely with arguments needed for
- // execution, without conflating the call with concerns of whether it is
- // sync or async. One shouldn't need to alter a call's arguments if the
- // implementation switches from sync to async (or vice versa). By having
- // async functions return promises, the concerns of making the call are
- // separated from the concerns of asynchronous interaction (which are
+ // The motivation for promises fundamentally is about creating a
+ // separation of concerns that allows one to achieve the same type of
+ // call patterns and logical data flow in asynchronous code as can be
+ // achieved in synchronous code. Promises allows one
+ // to be able to call a function purely with arguments needed for
+ // execution, without conflating the call with concerns of whether it is
+ // sync or async. One shouldn't need to alter a call's arguments if the
+ // implementation switches from sync to async (or vice versa). By having
+ // async functions return promises, the concerns of making the call are
+ // separated from the concerns of asynchronous interaction (which are
// handled by the promise).
- //
- // The dojo.Deferred is a type of promise that provides methods for fulfilling the
- // promise with a successful result or an error. The most important method for
- // working with Dojo's promises is the then() method, which follows the
+ //
+ // The dojo.Deferred is a type of promise that provides methods for fulfilling the
+ // promise with a successful result or an error. The most important method for
+ // working with Dojo's promises is the then() method, which follows the
// CommonJS proposed promise API. An example of using a Dojo promise:
- //
+ //
// | var resultingPromise = someAsyncOperation.then(function(result){
// | ... handle result ...
// | },
// | function(error){
// | ... handle error ...
// | });
- //
- // The .then() call returns a new promise that represents the result of the
+ //
+ // The .then() call returns a new promise that represents the result of the
// execution of the callback. The callbacks will never affect the original promises value.
//
// The dojo.Deferred instances also provide the following functions for backwards compatibility:
@@ -55,7 +56,7 @@ dojo.require("dojo._base.lang");
// * callback(result)
// * errback(result)
//
- // Callbacks are allowed to return promisesthemselves, so
+ // Callbacks are allowed to return promises themselves, so
// you can build complicated sequences of events with ease.
//
// The creator of the Deferred may specify a canceller. The canceller
@@ -115,7 +116,7 @@ dojo.require("dojo._base.lang");
// | renderDataitem(data[x]);
// | }
// | d.callback(true);
- // | }catch(e){
+ // | }catch(e){
// | d.errback(new Error("rendering failed"));
// | }
// | return d;
@@ -129,7 +130,7 @@ dojo.require("dojo._base.lang");
// | // again, so we could chain adding callbacks or save the
// | // deferred for later should we need to be notified again.
// example:
- // In this example, renderLotsOfData is syncrhonous and so both
+ // In this example, renderLotsOfData is synchronous and so both
// versions are pretty artificial. Putting the data display on a
// timeout helps show why Deferreds rock:
//
@@ -142,7 +143,7 @@ dojo.require("dojo._base.lang");
// | renderDataitem(data[x]);
// | }
// | d.callback(true);
- // | }catch(e){
+ // | }catch(e){
// | d.errback(new Error("rendering failed"));
// | }
// | }, 100);
@@ -157,11 +158,11 @@ dojo.require("dojo._base.lang");
// Note that the caller doesn't have to change his code at all to
// handle the asynchronous case.
var result, finished, isError, head, nextListener;
- var promise = this.promise = {};
+ var promise = (this.promise = {});
function complete(value){
if(finished){
- throw new Error("This deferred has already been resolved");
+ throw new Error("This deferred has already been resolved");
}
result = value;
finished = true;
@@ -172,7 +173,7 @@ dojo.require("dojo._base.lang");
while(!mutated && nextListener){
var listener = nextListener;
nextListener = nextListener.next;
- if(mutated = (listener.progress == mutator)){ // assignment and check
+ if((mutated = (listener.progress == mutator))){ // assignment and check
finished = false;
}
var func = (isError ? listener.error : listener.resolved);
@@ -184,6 +185,9 @@ dojo.require("dojo._base.lang");
continue;
}
var unchanged = mutated && newResult === undefined;
+ if(mutated && !unchanged){
+ isError = newResult instanceof Error;
+ }
listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
}
catch (e) {
@@ -196,7 +200,7 @@ dojo.require("dojo._base.lang");
listener.deferred.resolve(result);
}
}
- }
+ }
}
// calling resolve will resolve the promise
this.resolve = this.callback = function(value){
@@ -211,7 +215,7 @@ dojo.require("dojo._base.lang");
// calling error will indicate that the promise failed
this.reject = this.errback = function(error){
// summary:
- // Fulfills the Deferred instance as an error with the provided error
+ // Fulfills the Deferred instance as an error with the provided error
isError = true;
this.fired = 1;
complete(error);
@@ -228,7 +232,7 @@ dojo.require("dojo._base.lang");
while(listener){
var progress = listener.progress;
progress && progress(update);
- listener = listener.next;
+ listener = listener.next;
}
};
this.addCallbacks = function(/*Function?*/callback, /*Function?*/errback){
@@ -237,35 +241,35 @@ dojo.require("dojo._base.lang");
};
// provide the implementation of the promise
this.then = promise.then = function(/*Function?*/resolvedCallback, /*Function?*/errorCallback, /*Function?*/progressCallback){
- // summary
- // Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
- // completion of a promise. The fulfilledHandler is called when the promise
- // is fulfilled. The errorHandler is called when a promise fails. The
- // progressHandler is called for progress events. All arguments are optional
- // and non-function values are ignored. The progressHandler is not only an
- // optional argument, but progress events are purely optional. Promise
+ // summary:
+ // Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
+ // completion of a promise. The fulfilledHandler is called when the promise
+ // is fulfilled. The errorHandler is called when a promise fails. The
+ // progressHandler is called for progress events. All arguments are optional
+ // and non-function values are ignored. The progressHandler is not only an
+ // optional argument, but progress events are purely optional. Promise
// providers are not required to ever create progress events.
- //
- // This function will return a new promise that is fulfilled when the given
- // fulfilledHandler or errorHandler callback is finished. This allows promise
- // operations to be chained together. The value returned from the callback
- // handler is the fulfillment value for the returned promise. If the callback
+ //
+ // This function will return a new promise that is fulfilled when the given
+ // fulfilledHandler or errorHandler callback is finished. This allows promise
+ // operations to be chained together. The value returned from the callback
+ // handler is the fulfillment value for the returned promise. If the callback
// throws an error, the returned promise will be moved to failed state.
- //
+ //
// example:
// An example of using a CommonJS compliant promise:
// | asyncComputeTheAnswerToEverything().
// | then(addTwo).
// | then(printResult, onError);
- // | >44
- //
+ // | >44
+ //
var returnDeferred = progressCallback == mutator ? this : new dojo.Deferred(promise.cancel);
var listener = {
- resolved: resolvedCallback,
- error: errorCallback,
- progress: progressCallback,
+ resolved: resolvedCallback,
+ error: errorCallback,
+ progress: progressCallback,
deferred: returnDeferred
- };
+ };
if(nextListener){
head = head.next = listener;
}
@@ -291,7 +295,7 @@ dojo.require("dojo._base.lang");
deferred.reject(error);
}
}
- }
+ };
freeze(promise);
};
dojo.extend(dojo.Deferred, {
@@ -312,7 +316,7 @@ dojo.require("dojo._base.lang");
})();
dojo.when = function(promiseOrValue, /*Function?*/callback, /*Function?*/errback, /*Function?*/progressHandler){
// summary:
- // This provides normalization between normal synchronous values and
+ // This provides normalization between normal synchronous values and
// asynchronous promises, so you can interact with them in a common way
// example:
// | function printFirstAndList(items){
diff --git a/lib/dojo/_base/NodeList.js b/lib/dojo/_base/NodeList.js
index 12b631a4b..8cdc1c0f7 100644
--- a/lib/dojo/_base/NodeList.js
+++ b/lib/dojo/_base/NodeList.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,6 +10,9 @@ dojo._hasResource["dojo._base.NodeList"] = true;
dojo.provide("dojo._base.NodeList");
dojo.require("dojo._base.lang");
dojo.require("dojo._base.array");
+dojo.require("dojo._base.connect");
+dojo.require("dojo._base.html");
+
(function(){
@@ -248,7 +251,7 @@ dojo.require("dojo._base.array");
});
// add forEach actions
- d.forEach(["connect", "addClass", "removeClass", "toggleClass", "empty", "removeAttr"], function(name){
+ d.forEach(["connect", "addClass", "removeClass", "replaceClass", "toggleClass", "empty", "removeAttr"], function(name){
nlp[name] = adaptAsForEach(d[name]);
});
@@ -306,7 +309,7 @@ dojo.require("dojo._base.array");
_cloneNode: function(/*DOMNode*/ node){
// summary:
- // private utiltity to clone a node. Not very interesting in the vanilla
+ // private utility to clone a node. Not very interesting in the vanilla
// dojo.NodeList case, but delegates could do interesting things like
// clone event handlers if that is derivable from the node.
return node.cloneNode(true);
@@ -400,7 +403,7 @@ dojo.require("dojo._base.array");
if(this._parent){
return this._parent;
}else{
- //Just return empy list.
+ //Just return empty list.
return new this._NodeListCtor();
}
},
@@ -468,12 +471,12 @@ dojo.require("dojo._base.array");
indexOf: function(value, fromIndex){
// summary:
- // see dojo.indexOf(). The primary difference is that the acted-on
+ // see dojo.indexOf(). The primary difference is that the acted-on
// array is implicitly this NodeList
// value: Object:
// The value to search for.
// fromIndex: Integer?:
- // The loction to start searching from. Optional. Defaults to 0.
+ // The location to start searching from. Optional. Defaults to 0.
// description:
// For more details on the behavior of indexOf, see Mozilla's
// (indexOf
@@ -494,7 +497,7 @@ dojo.require("dojo._base.array");
// value: Object
// The value to search for.
// fromIndex: Integer?
- // The loction to start searching from. Optional. Defaults to 0.
+ // The location to start searching from. Optional. Defaults to 0.
// returns:
// Positive Integer or 0 for a match, -1 of not found.
return d.lastIndexOf(this, value, fromIndex); // Integer
@@ -572,12 +575,12 @@ dojo.require("dojo._base.array");
forEach: function(callback, thisObj){
// summary:
- // see `dojo.forEach()`. The primary difference is that the acted-on
+ // see `dojo.forEach()`. The primary difference is that the acted-on
// array is implicitly this NodeList. If you want the option to break out
// of the forEach loop, use every() or some() instead.
d.forEach(this, callback, thisObj);
// non-standard return to allow easier chaining
- return this; // dojo.NodeList
+ return this; // dojo.NodeList
},
/*=====
@@ -594,7 +597,7 @@ dojo.require("dojo._base.array");
// summary:
// Returns border-box objects (x/y/w/h) of all elements in a node list
// as an Array (*not* a NodeList). Acts like `dojo.position`, though
- // assumes the node passed is each node in this list.
+ // assumes the node passed is each node in this list.
return d.map(this, d.position); // Array
},
@@ -617,7 +620,7 @@ dojo.require("dojo._base.array");
// Disable a group of buttons:
// | dojo.query("button.group").attr("disabled", true);
// example:
- // innerHTML can be assigned or retreived as well:
+ // innerHTML can be assigned or retrieved as well:
// | // get the innerHTML (as an array) for each list item
// | var ih = dojo.query("li.replaceable").attr("innerHTML");
return; // dojo.NodeList
@@ -682,7 +685,7 @@ dojo.require("dojo._base.array");
// if 2 arguments are passed (methodName, objOrFunc), objOrFunc should
// reference a function or be the name of the function in the global
// namespace to attach. If 3 arguments are provided
- // (methodName, objOrFunc, funcName), objOrFunc must be the scope to
+ // (methodName, objOrFunc, funcName), objOrFunc must be the scope to
// locate the bound function in
// funcName: String?
// optional. A string naming the function in objOrFunc to bind to the
@@ -728,7 +731,7 @@ dojo.require("dojo._base.array");
// by queryOrNode. Returns the original NodeList. See: `dojo.place`
// queryOrNode:
// may be a string representing any valid CSS3 selector or a DOM node.
- // In the selector case, only the first matching element will be used
+ // In the selector case, only the first matching element will be used
// for relative positioning.
// position:
// can be one of:
@@ -743,18 +746,15 @@ dojo.require("dojo._base.array");
return this.forEach(function(node){ d.place(node, item, position); }); // dojo.NodeList
},
- orphan: function(/*String?*/ simpleFilter){
+ orphan: function(/*String?*/ filter){
// summary:
- // removes elements in this list that match the simple filter
+ // removes elements in this list that match the filter
// from their parents and returns them as a new NodeList.
- // simpleFilter:
- // single-expression CSS rule. For example, ".thinger" or
- // "#someId[attrName='value']" but not "div > span". In short,
- // anything which does not invoke a descent to evaluate but
- // can instead be used to test a single node is acceptable.
+ // filter:
+ // CSS selector like ".foo" or "div > span"
// returns:
- // `dojo.NodeList` containing the orpahned elements
- return (simpleFilter ? d._filterQueryResult(this, simpleFilter) : this).forEach(orphan); // dojo.NodeList
+ // `dojo.NodeList` containing the orphaned elements
+ return (filter ? d._filterQueryResult(this, filter) : this).forEach(orphan); // dojo.NodeList
},
adopt: function(/*String||Array||DomNode*/ queryOrListOrNode, /*String?*/ position){
@@ -781,7 +781,7 @@ dojo.require("dojo._base.array");
// FIXME: do we need this?
query: function(/*String*/ queryStr){
// summary:
- // Returns a new list whose memebers match the passed query,
+ // Returns a new list whose members match the passed query,
// assuming elements of the current NodeList as the root for
// each search.
// example:
@@ -792,9 +792,9 @@ dojo.require("dojo._base.array");
// |
// |
// |
- // |
great commedians may not be funny in person
+ // |
great comedians may not be funny in person
// |
- // If we are presented with the following defintion for a NodeList:
+ // If we are presented with the following definition for a NodeList:
// | var l = new dojo.NodeList(dojo.byId("foo"), dojo.byId("bar"));
// it's possible to find all span elements under paragraphs
// contained by these elements with this sub-query:
@@ -809,18 +809,14 @@ dojo.require("dojo._base.array");
return this._wrap(apc.apply([], ret), this); // dojo.NodeList
},
- filter: function(/*String|Function*/ simpleFilter){
+ filter: function(/*String|Function*/ filter){
// summary:
// "masks" the built-in javascript filter() method (supported
// in Dojo via `dojo.filter`) to support passing a simple
// string filter in addition to supporting filtering function
// objects.
- // simpleFilter:
- // If a string, a single-expression CSS rule. For example,
- // ".thinger" or "#someId[attrName='value']" but not "div >
- // span". In short, anything which does not invoke a descent
- // to evaluate but can instead be used to test a single node
- // is acceptable.
+ // filter:
+ // If a string, a CSS rule like ".thinger" or "div > span".
// example:
// "regular" JS filter syntax as exposed in dojo.filter:
// | dojo.query("*").filter(function(item){
@@ -832,7 +828,7 @@ dojo.require("dojo._base.array");
// | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
var a = arguments, items = this, start = 0;
- if(typeof simpleFilter == "string"){ // inline'd type check
+ if(typeof filter == "string"){ // inline'd type check
items = d._filterQueryResult(this, a[0]);
if(a.length == 1){
// if we only got a string query, pass back the filtered results
@@ -880,10 +876,10 @@ dojo.require("dojo._base.array");
// | "before"
// | "after"
// | "replace" (replaces nodes in this NodeList with new content)
- // | "only" (removes other children of the nodes so new content is hte only child)
+ // | "only" (removes other children of the nodes so new content is the only child)
// or an offset in the childNodes property
// example:
- // appends content to the end if the position is ommitted
+ // appends content to the end if the position is omitted
// | dojo.query("h3 > p").addContent("hey there!");
// example:
// add something to the front of each element that has a
@@ -914,7 +910,7 @@ dojo.require("dojo._base.array");
// text: "Send"
// });
content = this._normalize(content, this[0]);
- for(var i = 0, node; node = this[i]; i++){
+ for(var i = 0, node; (node = this[i]); i++){
this._place(content, node, position, i > 0);
}
return this; //dojo.NodeList
@@ -943,11 +939,11 @@ dojo.require("dojo._base.array");
// index: Integer...
// One or more 0-based indices of items in the current
// NodeList. A negative index will start at the end of the
- // list and go backwards.
+ // list and go backwards.
//
// example:
// Shorten the list to the first, second, and third elements
- // | dojo.query("a").at(0, 1, 2).forEach(fn);
+ // | dojo.query("a").at(0, 1, 2).forEach(fn);
//
// example:
// Retrieve the first and last elements of a unordered list:
@@ -957,13 +953,13 @@ dojo.require("dojo._base.array");
// Do something for the first element only, but end() out back to
// the original list and continue chaining:
// | dojo.query("a").at(0).onclick(fn).end().forEach(function(n){
- // | console.log(n); // all anchors on the page.
- // | })
+ // | console.log(n); // all anchors on the page.
+ // | })
//
// returns:
// dojo.NodeList
var t = new this._NodeListCtor();
- d.forEach(arguments, function(i){
+ d.forEach(arguments, function(i){
if(i < 0){ i = this.length + i }
if(this[i]){ t.push(this[i]); }
}, this);
@@ -973,7 +969,8 @@ dojo.require("dojo._base.array");
});
nl.events = [
- // summary: list of all DOM events used in NodeList
+ // summary:
+ // list of all DOM events used in NodeList
"blur", "focus", "change", "click", "error", "keydown", "keypress",
"keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove",
"mouseout", "mouseover", "mouseup", "submit"
@@ -986,7 +983,7 @@ dojo.require("dojo._base.array");
var _oe = "on" + evt;
nlp[_oe] = function(a, b){
return this.connect(_oe, a, b);
- }
+ };
// FIXME: should these events trigger publishes?
/*
return (a ? this.connect(_oe, a, b) :
diff --git a/lib/dojo/_base/_loader/bootstrap.js b/lib/dojo/_base/_loader/bootstrap.js
index 3ef3012a2..a1f99276a 100644
--- a/lib/dojo/_base/_loader/bootstrap.js
+++ b/lib/dojo/_base/_loader/bootstrap.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -76,7 +76,7 @@ djConfig = {
// of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
// modules may be configured via `djConfig.modulePaths`.
modulePaths: {},
- // afterOnLoad: Boolean
+ // afterOnLoad: Boolean
// Indicates Dojo was added to the page after the page load. In this case
// Dojo will not wait for the page DOMContentLoad/load events and fire
// its dojo.addOnLoad callbacks after making sure all outstanding
@@ -103,7 +103,7 @@ djConfig = {
// dojoBlankHtmlUrl: String
// Used by some modules to configure an empty iframe. Used by dojo.io.iframe and
// dojo.back, and dijit popup support in IE where an iframe is needed to make sure native
- // controls do not bleed through the popups. Normally this configuration variable
+ // controls do not bleed through the popups. Normally this configuration variable
// does not need to be set, except when using cross-domain/CDN Dojo builds.
// Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
// to the path on your domain your copy of blank.html.
@@ -149,7 +149,7 @@ djConfig = {
"groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
"trace", "warn", "log"
];
- var i=0, tn;
+ var i = 0, tn;
while((tn=cn[i++])){
if(!console[tn]){
(function(){
@@ -209,9 +209,13 @@ dojo.global = {
debugAtAllCosts: false
};
- if(typeof djConfig != "undefined"){
- for(var opt in djConfig){
- d.config[opt] = djConfig[opt];
+ // FIXME: 2.0, drop djConfig support. Use dojoConfig exclusively for global config.
+ var cfg = typeof djConfig != "undefined" ? djConfig :
+ typeof dojoConfig != "undefined" ? dojoConfig : null;
+
+ if(cfg){
+ for(var c in cfg){
+ d.config[c] = cfg[c];
}
}
@@ -223,7 +227,7 @@ dojo.global = {
=====*/
dojo.locale = d.config.locale;
- var rev = "$Rev: 22487 $".match(/\d+/);
+ var rev = "$Rev: 24595 $".match(/\d+/);
/*=====
dojo.version = function(){
@@ -247,7 +251,7 @@ dojo.global = {
}
=====*/
dojo.version = {
- major: 1, minor: 5, patch: 0, flag: "",
+ major: 1, minor: 6, patch: 1, flag: "",
revision: rev ? +rev[0] : NaN,
toString: function(){
with(d.version){
@@ -323,7 +327,7 @@ dojo.global = {
// | constructor: function(properties){
// | // property configuration:
// | dojo.mixin(this, properties);
- // |
+ // |
// | console.log(this.quip);
// | // ...
// | },
@@ -344,7 +348,7 @@ dojo.global = {
// | name: "Carl Brutanananadilewski"
// | }
// | );
- // |
+ // |
// | // will print "Carl Brutanananadilewski"
// | console.log(flattened.name);
// | // will print "true"
@@ -419,10 +423,7 @@ dojo.global = {
// determine if an object supports a given method
// description:
// useful for longer api chains where you have to test each object in
- // the chain. Useful only for object and method detection.
- // Not useful for testing generic properties on an object.
- // In particular, dojo.exists("foo.bar") when foo.bar = ""
- // will return false. Use ("bar" in foo) to test for those cases.
+ // the chain. Useful for object and method detection.
// name:
// Path to an object, in the form "A.B.C".
// obj:
@@ -441,7 +442,7 @@ dojo.global = {
// | // search from a particular scope
// | dojo.exists("bar", foo); // true
// | dojo.exists("bar.baz", foo); // false
- return !!d.getObject(name, false, obj); // Boolean
+ return d.getObject(name, false, obj) !== undefined; // Boolean
}
dojo["eval"] = function(/*String*/ scriptFragment){
diff --git a/lib/dojo/_base/_loader/hostenv_browser.js b/lib/dojo/_base/_loader/hostenv_browser.js
index 7d92d70e3..b31bd77dc 100644
--- a/lib/dojo/_base/_loader/hostenv_browser.js
+++ b/lib/dojo/_base/_loader/hostenv_browser.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -26,9 +26,9 @@ dojo.isIE = {
dojo.isSafari = {
// example:
// | if(dojo.isSafari){ ... }
- // example:
+ // example:
// Detect iPhone:
- // | if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){
+ // | if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){
// | // we are iPhone. Note, iPod touch reports "iPod" above and fails this test.
// | }
};
@@ -71,7 +71,6 @@ dojo = {
// True if the client runs on Mac
}
=====*/
-
if(typeof window != 'undefined'){
dojo.isBrowser = true;
dojo._name = "browser";
@@ -98,7 +97,7 @@ if(typeof window != 'undefined'){
d.config.baseUrl = src.substring(0, m.index);
}
// and find out if we need to modify our behavior
- var cfg = scripts[i].getAttribute("djConfig");
+ var cfg = (scripts[i].getAttribute("djConfig") || scripts[i].getAttribute("data-dojo-config"));
if(cfg){
var cfgo = eval("({ "+cfg+" })");
for(var x in cfgo){
@@ -172,7 +171,7 @@ if(typeof window != 'undefined'){
d._XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
d._xhrObj = function(){
- // summary:
+ // summary:
// does the work of portably generating a new XMLHTTPRequest object.
var http, last_e;
if(!dojo.isIE || !dojo.config.ieForceActiveXXhr){
@@ -205,10 +204,11 @@ if(typeof window != 'undefined'){
var stat = http.status || 0,
lp = location.protocol;
return (stat >= 200 && stat < 300) || // Boolean
- stat == 304 || // allow any 2XX response code
- stat == 1223 || // get it out of the cache
+ stat == 304 || // allow any 2XX response code
+ stat == 1223 || // get it out of the cache
+ // Internet Explorer mangled the status code
// Internet Explorer mangled the status code OR we're Titanium/browser chrome/chrome extension requesting a local file
- (!stat && (lp == "file:" || lp == "chrome:" || lp == "chrome-extension:" || lp == "app:") );
+ (!stat && (lp == "file:" || lp == "chrome:" || lp == "chrome-extension:" || lp == "app:"));
}
//See if base tag is in use.
@@ -303,7 +303,7 @@ if(typeof window != 'undefined'){
d.addOnWindowUnload = function(/*Object?|Function?*/obj, /*String|Function?*/functionName){
// summary:
// registers a function to be triggered when window.onunload
- // fires.
+ // fires.
// description:
// The first time that addOnWindowUnload is called Dojo
// will register a page listener to trigger your unload
@@ -334,7 +334,7 @@ if(typeof window != 'undefined'){
// description:
// The first time that addOnUnload is called Dojo will
// register a page listener to trigger your unload handler
- // with.
+ // with.
//
// In a browser enviroment, the functions will be triggered
// during the window.onbeforeunload event. Be careful of doing
@@ -347,7 +347,7 @@ if(typeof window != 'undefined'){
//
// Further note that calling dojo.addOnUnload will prevent
// browsers from using a "fast back" cache to make page
- // loading via back button instantaneous.
+ // loading via back button instantaneous.
// example:
// | dojo.addOnUnload(functionPointer)
// | dojo.addOnUnload(object, "functionName")
@@ -384,7 +384,7 @@ if(typeof window != 'undefined'){
}
}
- if(!dojo.config.afterOnLoad){
+ if(!dojo.config.afterOnLoad){
if(document.addEventListener){
//Standards. Hooray! Assumption here that if standards based,
//it knows about DOMContentLoaded. It is OK if it does not, the fall through
@@ -401,10 +401,10 @@ if(typeof window != 'undefined'){
if(!dojo.config.skipIeDomLoaded && self === self.top){
dojo._scrollIntervalId = setInterval(function (){
try{
- //When dojo is loaded into an iframe in an IE HTML Application
+ //When dojo is loaded into an iframe in an IE HTML Application
//(HTA), such as in a selenium test, javascript in the iframe
//can't see anything outside of it, so self===self.top is true,
- //but the iframe is not the top window and doScroll will be
+ //but the iframe is not the top window and doScroll will be
//available before document.body is set. Test document.body
//before trying the doScroll trick
if(document.body){
@@ -467,8 +467,11 @@ if(dojo.config.isDebug){
}
if(dojo.config.debugAtAllCosts){
- dojo.config.useXDomain = true;
- dojo.require("dojo._base._loader.loader_xd");
+ // this breaks the new AMD based module loader. The XDomain won't be necessary
+ // anyway if you switch to the asynchronous loader
+ //dojo.config.useXDomain = true;
+ //dojo.require("dojo._base._loader.loader_xd");
dojo.require("dojo._base._loader.loader_debug");
dojo.require("dojo.i18n");
}
+
diff --git a/lib/dojo/_base/_loader/hostenv_ff_ext.js b/lib/dojo/_base/_loader/hostenv_ff_ext.js
index 94a0a8046..ca47a4c1c 100644
--- a/lib/dojo/_base/_loader/hostenv_ff_ext.js
+++ b/lib/dojo/_base/_loader/hostenv_ff_ext.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -241,7 +241,7 @@ if(typeof window != 'undefined'){
return oc;
};
- // FIXME:
+ // FIXME:
// don't really like the current arguments and order to
// _inContext, so don't make it public until it's right!
dojo._inContext = function(g, d, f){
@@ -302,7 +302,7 @@ if(typeof window != 'undefined'){
// Dojo's to fire once..but we might care if pages navigate. We'll
// probably need an extension-specific API
if(!dojo.config.afterOnLoad){
- window.addEventListener("DOMContentLoaded",function(e){
+ window.addEventListener("DOMContentLoaded",function(e){
dojo._loadInit(e);
// console.log("DOM content loaded", e);
}, false);
diff --git a/lib/dojo/_base/_loader/hostenv_rhino.js b/lib/dojo/_base/_loader/hostenv_rhino.js
index ee9ad8b43..e3aa78524 100644
--- a/lib/dojo/_base/_loader/hostenv_rhino.js
+++ b/lib/dojo/_base/_loader/hostenv_rhino.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -58,6 +58,9 @@ dojo._isLocalUrl = function(/*String*/ uri) {
// see comments in spidermonkey loadUri
dojo._loadUri = function(uri, cb){
+ if(dojo._loadedUrls[uri]){
+ return true; // Boolean
+ }
try{
var local;
try{
@@ -67,29 +70,32 @@ dojo._loadUri = function(uri, cb){
return false;
}
+ dojo._loadedUrls[uri] = true;
//FIXME: Use Rhino 1.6 native readFile/readUrl if available?
if(cb){
var contents = (local ? readText : readUri)(uri, "UTF-8");
// patch up the input to eval until https://bugzilla.mozilla.org/show_bug.cgi?id=471005 is fixed.
if(!eval("'\u200f'").length){
- contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){
- return "\\u" + match.charCodeAt(0).toString(16);
+ contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){
+ return "\\u" + match.charCodeAt(0).toString(16);
})
}
-
- cb(eval('('+contents+')'));
+ contents = /^define\(/.test(contents) ? contents : '('+contents+')';
+ cb(eval(contents));
}else{
load(uri);
}
+ dojo._loadedUrls.push(uri);
return true;
}catch(e){
+ dojo._loadedUrls[uri] = false;
console.debug("rhino load('" + uri + "') failed. Exception: " + e);
return false;
}
}
-dojo.exit = function(exitcode){
+dojo.exit = function(exitcode){
quit(exitcode);
}
@@ -157,7 +163,7 @@ dojo._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
dojo.doc = typeof document != "undefined" ? document : null;
dojo.body = function(){
- return document.body;
+ return document.body;
}
// Supply setTimeout/clearTimeout implementations if they aren't already there
diff --git a/lib/dojo/_base/_loader/hostenv_spidermonkey.js b/lib/dojo/_base/_loader/hostenv_spidermonkey.js
index 17b21f5f0..a3d2dfc6f 100644
--- a/lib/dojo/_base/_loader/hostenv_spidermonkey.js
+++ b/lib/dojo/_base/_loader/hostenv_spidermonkey.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -19,13 +19,13 @@ dojo._name = 'spidermonkey';
/*=====
dojo.isSpidermonkey = {
- // summary: Detect spidermonkey
+ // summary: Detect spidermonkey
};
=====*/
dojo.isSpidermonkey = true;
-dojo.exit = function(exitcode){
- quit(exitcode);
+dojo.exit = function(exitcode){
+ quit(exitcode);
}
if(typeof print == "function"){
@@ -37,15 +37,15 @@ if(typeof line2pc == 'undefined'){
}
dojo._spidermonkeyCurrentFile = function(depth){
- //
+ //
// This is a hack that determines the current script file by parsing a
// generated stack trace (relying on the non-standard "stack" member variable
// of the SpiderMonkey Error object).
- //
+ //
// If param depth is passed in, it'll return the script file which is that far down
// the stack, but that does require that you know how deep your stack is when you are
// calling.
- //
+ //
var s = '';
try{
throw Error("whatever");
@@ -54,23 +54,23 @@ dojo._spidermonkeyCurrentFile = function(depth){
}
// lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
var matches = s.match(/[^@]*\.js/gi);
- if(!matches){
+ if(!matches){
throw Error("could not parse stack string: '" + s + "'");
}
var fname = (typeof depth != 'undefined' && depth) ? matches[depth + 1] : matches[matches.length - 1];
- if(!fname){
+ if(!fname){
throw Error("could not find file name in stack string '" + s + "'");
}
//print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
return fname;
}
-// print(dojo._spidermonkeyCurrentFile(0));
+// print(dojo._spidermonkeyCurrentFile(0));
dojo._loadUri = function(uri){
// spidermonkey load() evaluates the contents into the global scope (which
// is what we want).
- // TODO: sigh, load() does not return a useful value.
+ // TODO: sigh, load() does not return a useful value.
// Perhaps it is returning the value of the last thing evaluated?
var ok = load(uri);
// console.log("spidermonkey load(", uri, ") returned ", ok);
diff --git a/lib/dojo/_base/_loader/loader.js b/lib/dojo/_base/_loader/loader.js
index 9206de888..73df544fa 100644
--- a/lib/dojo/_base/_loader/loader.js
+++ b/lib/dojo/_base/_loader/loader.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -11,9 +11,8 @@ dojo._hasResource["dojo.foo"] = true;
* loader.js - A bootstrap module. Runs before the hostenv_*.js file. Contains
* all of the package loading methods.
*/
-
(function(){
- var d = dojo;
+ var d = dojo, currentModule;
d.mixin(d, {
_loadedModules: {},
@@ -45,11 +44,11 @@ dojo._hasResource["dojo.foo"] = true;
_loadedUrls: [],
- //WARNING:
+ //WARNING:
// This variable is referenced by packages outside of bootstrap:
// FloatingPane.js and undo/browser.js
_postLoad: false,
-
+
//Egad! Lots of test files push on this directly instead of using dojo.addOnLoad.
_loaders: [],
_unloaders: [],
@@ -68,21 +67,24 @@ dojo._hasResource["dojo.foo"] = true;
// not caught by us, so the caller will see it. We return a true
// value if and only if the script is found.
//
- // relpath:
+ // relpath:
// A relative path to a script (no leading '/', and typically ending
// in '.js').
- // module:
+ // module:
// A module whose existance to check for after loading a path. Can be
// used to determine success or failure of the load.
- // cb:
+ // cb:
// a callback function to pass the result of evaluating the script
var uri = ((relpath.charAt(0) == '/' || relpath.match(/^\w+:/)) ? "" : d.baseUrl) + relpath;
try{
+ currentModule = module;
return !module ? d._loadUri(uri, cb) : d._loadUriAndCheck(uri, module, cb); // Boolean
}catch(e){
console.error(e);
return false; // Boolean
+ }finally{
+ currentModule = null;
}
}
@@ -95,7 +97,7 @@ dojo._hasResource["dojo.foo"] = true;
// it succeeded. Returns false if the URI reading failed. Throws if
// the evaluation throws.
// uri: a uri which points at the script to be loaded
- // cb:
+ // cb:
// a callback function to process the result of evaluating the script
// as an expression, typically used by the resource bundle loader to
// load JSON-style resources
@@ -109,7 +111,8 @@ dojo._hasResource["dojo.foo"] = true;
d._loadedUrls[uri] = true;
d._loadedUrls.push(uri);
if(cb){
- contents = '('+contents+')';
+ //conditional to support script-inject i18n bundle format
+ contents = /^define\(/.test(contents) ? contents : '('+contents+')';
}else{
//Only do the scoping if no callback. If a callback is specified,
//it is most likely the i18n bundle stuff.
@@ -121,16 +124,16 @@ dojo._hasResource["dojo.foo"] = true;
}
// Check to see if we need to call _callLoaded() due to an addOnLoad() that arrived while we were busy downloading
if(--d._inFlightCount == 0 && d._postLoad && d._loaders.length){
- // We shouldn't be allowed to get here but Firefox allows an event
- // (mouse, keybd, async xhrGet) to interrupt a synchronous xhrGet.
+ // We shouldn't be allowed to get here but Firefox allows an event
+ // (mouse, keybd, async xhrGet) to interrupt a synchronous xhrGet.
// If the current script block contains multiple require() statements, then after each
// require() returns, inFlightCount == 0, but we want to hold the _callLoaded() until
// all require()s are done since the out-of-sequence addOnLoad() presumably needs them all.
// setTimeout allows the next require() to start (if needed), and then we check this again.
- setTimeout(function(){
- // If inFlightCount > 0, then multiple require()s are running sequentially and
+ setTimeout(function(){
+ // If inFlightCount > 0, then multiple require()s are running sequentially and
// the next require() started after setTimeout() was executed but before we got here.
- if(d._inFlightCount == 0){
+ if(d._inFlightCount == 0){
d._callLoaded();
}
}, 0);
@@ -153,10 +156,10 @@ dojo._hasResource["dojo.foo"] = true;
dojo.loaded = function(){
// summary:
// signal fired when initial environment and package loading is
- // complete. You should use dojo.addOnLoad() instead of doing a
+ // complete. You should use dojo.addOnLoad() instead of doing a
// direct dojo.connect() to this method in order to handle
// initialization tasks that require the environment to be
- // initialized. In a browser host, declarative widgets will
+ // initialized. In a browser host, declarative widgets will
// be constructed when this function finishes runing.
d._loadNotifying = true;
d._postLoad = true;
@@ -183,8 +186,8 @@ dojo._hasResource["dojo.foo"] = true;
dojo.unloaded = function(){
// summary:
// signal fired by impending environment destruction. You should use
- // dojo.addOnUnload() instead of doing a direct dojo.connect() to this
- // method to perform page/application cleanup methods. See
+ // dojo.addOnUnload() instead of doing a direct dojo.connect() to this
+ // method to perform page/application cleanup methods. See
// dojo.addOnUnload for more info.
var mll = d._unloaders;
while(mll.length){
@@ -203,13 +206,13 @@ dojo._hasResource["dojo.foo"] = true;
dojo.ready = dojo.addOnLoad = function(/*Object*/obj, /*String|Function?*/functionName){
// summary:
- // Registers a function to be triggered after the DOM and dojo.require() calls
+ // Registers a function to be triggered after the DOM and dojo.require() calls
// have finished loading.
//
// description:
// Registers a function to be triggered after the DOM has finished
- // loading and `dojo.require` modules have loaded. Widgets declared in markup
- // have been instantiated if `djConfig.parseOnLoad` is true when this fires.
+ // loading and `dojo.require` modules have loaded. Widgets declared in markup
+ // have been instantiated if `djConfig.parseOnLoad` is true when this fires.
//
// Images and CSS files may or may not have finished downloading when
// the specified function is called. (Note that widgets' CSS and HTML
@@ -252,7 +255,7 @@ dojo._hasResource["dojo.foo"] = true;
dojo._modulesLoaded = function(){
if(d._postLoad){ return; }
- if(d._inFlightCount > 0){
+ if(d._inFlightCount > 0){
console.warn("files still in flight!");
return;
}
@@ -284,8 +287,8 @@ dojo._hasResource["dojo.foo"] = true;
var syms = modulename.split(".");
for(var i = syms.length; i>0; i--){
var parentModule = syms.slice(0, i).join(".");
- if(i == 1 && !d._moduleHasPrefix(parentModule)){
- // Support default module directory (sibling of dojo) for top-level modules
+ if(i == 1 && !d._moduleHasPrefix(parentModule)){
+ // Support default module directory (sibling of dojo) for top-level modules
syms[0] = "../" + syms[0];
}else{
var parentModulePath = d._getModulePrefix(parentModule);
@@ -320,87 +323,95 @@ dojo._hasResource["dojo.foo"] = true;
dojo._loadModule = dojo.require = function(/*String*/moduleName, /*Boolean?*/omitModuleCheck){
// summary:
// loads a Javascript module from the appropriate URI
- // moduleName:
+ //
+ // moduleName: String
// module name to load, using periods for separators,
// e.g. "dojo.date.locale". Module paths are de-referenced by dojo's
// internal mapping of locations to names and are disambiguated by
// longest prefix. See `dojo.registerModulePath()` for details on
// registering new modules.
- // omitModuleCheck:
+ //
+ // omitModuleCheck: Boolean?
// if `true`, omitModuleCheck skips the step of ensuring that the
// loaded file actually defines the symbol it is referenced by.
// For example if it called as `dojo.require("a.b.c")` and the
// file located at `a/b/c.js` does not define an object `a.b.c`,
// and exception will be throws whereas no exception is raised
// when called as `dojo.require("a.b.c", true)`
+ //
// description:
// Modules are loaded via dojo.require by using one of two loaders: the normal loader
// and the xdomain loader. The xdomain loader is used when dojo was built with a
// custom build that specified loader=xdomain and the module lives on a modulePath
// that is a whole URL, with protocol and a domain. The versions of Dojo that are on
// the Google and AOL CDNs use the xdomain loader.
- //
+ //
// If the module is loaded via the xdomain loader, it is an asynchronous load, since
// the module is added via a dynamically created script tag. This
- // means that dojo.require() can return before the module has loaded. However, this
+ // means that dojo.require() can return before the module has loaded. However, this
// should only happen in the case where you do dojo.require calls in the top-level
// HTML page, or if you purposely avoid the loader checking for dojo.require
// dependencies in your module by using a syntax like dojo["require"] to load the module.
- //
+ //
// Sometimes it is useful to not have the loader detect the dojo.require calls in the
// module so that you can dynamically load the modules as a result of an action on the
// page, instead of right at module load time.
- //
+ //
// Also, for script blocks in an HTML page, the loader does not pre-process them, so
// it does not know to download the modules before the dojo.require calls occur.
- //
+ //
// So, in those two cases, when you want on-the-fly module loading or for script blocks
// in the HTML page, special care must be taken if the dojo.required code is loaded
// asynchronously. To make sure you can execute code that depends on the dojo.required
// modules, be sure to add the code that depends on the modules in a dojo.addOnLoad()
// callback. dojo.addOnLoad waits for all outstanding modules to finish loading before
- // executing. Example:
- //
- // |
- //
+ // executing.
+ //
// This type of syntax works with both xdomain and normal loaders, so it is good
// practice to always use this idiom for on-the-fly code loading and in HTML script
// blocks. If at some point you change loaders and where the code is loaded from,
// it will all still work.
- //
+ //
// More on how dojo.require
// `dojo.require("A.B")` first checks to see if symbol A.B is
// defined. If it is, it is simply returned (nothing to do).
- //
+ //
// If it is not defined, it will look for `A/B.js` in the script root
// directory.
- //
- // `dojo.require` throws an excpetion if it cannot find a file
+ //
+ // `dojo.require` throws an exception if it cannot find a file
// to load, or if the symbol `A.B` is not defined after loading.
- //
+ //
// It returns the object `A.B`, but note the caveats above about on-the-fly loading and
// HTML script blocks when the xdomain loader is loading a module.
- //
+ //
// `dojo.require()` does nothing about importing symbols into
// the current namespace. It is presumed that the caller will
- // take care of that. For example, to import all symbols into a
- // local block, you might write:
- //
+ // take care of that.
+ //
+ // example:
+ // To use dojo.require in conjunction with dojo.ready:
+ //
+ // | dojo.require("foo");
+ // | dojo.require("bar");
+ // | dojo.addOnLoad(function(){
+ // | //you can now safely do something with foo and bar
+ // | });
+ //
+ // example:
+ // For example, to import all symbols into a local block, you might write:
+ //
// | with (dojo.require("A.B")) {
// | ...
// | }
- //
+ //
// And to import just the leaf symbol to a local variable:
- //
+ //
// | var B = dojo.require("A.B");
// | ...
- // returns: the required namespace object
+ //
+ // returns:
+ // the required namespace object
omitModuleCheck = d._global_omit_module_check || omitModuleCheck;
//Check if it is already loaded.
@@ -411,10 +422,8 @@ dojo._hasResource["dojo.foo"] = true;
// convert periods to slashes
var relpath = d._getModuleSymbols(moduleName).join("/") + '.js';
-
var modArg = !omitModuleCheck ? moduleName : null;
var ok = d._loadPath(relpath, modArg);
-
if(!ok && !omitModuleCheck){
throw new Error("Could not load '" + moduleName + "'; last tried '" + relpath + "'");
}
@@ -425,7 +434,7 @@ dojo._hasResource["dojo.foo"] = true;
// pass in false so we can give better error
module = d._loadedModules[moduleName];
if(!module){
- throw new Error("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'");
+ throw new Error("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'");
}
}
@@ -446,14 +455,14 @@ dojo._hasResource["dojo.foo"] = true;
// the file name. For example, `js/dojo/foo.js` must have
// `dojo.provide("dojo.foo");` before any calls to
// `dojo.require()` are made.
- //
+ //
// For backwards compatibility reasons, in addition to registering
// the resource, `dojo.provide()` also ensures that the javascript
// object for the module exists. For example,
// `dojo.provide("dojox.data.FlickrStore")`, in addition to
// registering that `FlickrStore.js` is a resource for the
// `dojox.data` module, will ensure that the `dojox.data`
- // javascript object exists, so that calls like
+ // javascript object exists, so that calls like
// `dojo.data.foo = function(){ ... }` don't fail.
//
// In the case of a build where multiple javascript source files
@@ -462,11 +471,11 @@ dojo._hasResource["dojo.foo"] = true;
// note that it includes multiple resources.
//
// resourceName: String
- // A dot-sperated string identifying a resource.
+ // A dot-sperated string identifying a resource.
//
// example:
// Safely create a `my` object, and make dojo.require("my.CustomModule") work
- // | dojo.provide("my.CustomModule");
+ // | dojo.provide("my.CustomModule");
//Make sure we have a string.
resourceName = resourceName + "";
@@ -523,7 +532,7 @@ dojo._hasResource["dojo.foo"] = true;
if(condition === true){
// FIXME: why do we support chained require()'s here? does the build system?
var args = [];
- for(var i = 1; i < arguments.length; i++){
+ for(var i = 1; i < arguments.length; i++){
args.push(arguments[i]);
}
d.require.apply(d, args);
@@ -533,13 +542,13 @@ dojo._hasResource["dojo.foo"] = true;
dojo.requireAfterIf = d.requireIf;
dojo.registerModulePath = function(/*String*/module, /*String*/prefix){
- // summary:
+ // summary:
// Maps a module name to a path
- // description:
+ // description:
// An unregistered module is given the default path of ../[module],
// relative to Dojo root. For example, module acme is mapped to
// ../acme. If you want to use a different module name, use
- // dojo.registerModulePath.
+ // dojo.registerModulePath.
// example:
// If your dojo.js is located at this location in the web root:
// | /myapp/js/dojo/dojo/dojo.js
@@ -552,7 +561,7 @@ dojo._hasResource["dojo.foo"] = true;
// At which point you can then use dojo.require() to load the
// modules (assuming they provide() the same things which are
// required). The full code might be:
- // |
// |
d._modulePrefixes[module] = { name: module, value: prefix };
- }
-
+ };
+
dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String?*/availableFlatLocales){
// summary:
// Declares translated resources and loads them if necessary, in the
@@ -573,7 +582,7 @@ dojo._hasResource["dojo.foo"] = true;
// description:
// Load translated resource bundles provided underneath the "nls"
// directory within a package. Translated resources may be located in
- // different packages throughout the source tree.
+ // different packages throughout the source tree.
//
// Each directory is named for a locale as specified by RFC 3066,
// (http://www.ietf.org/rfc/rfc3066.txt), normalized in lowercase.
@@ -588,21 +597,21 @@ dojo._hasResource["dojo.foo"] = true;
// preload the bundles to avoid data redundancy and the multiple
// network hits normally required to load these resources.
//
- // moduleName:
+ // moduleName:
// name of the package containing the "nls" directory in which the
// bundle is found
//
- // bundleName:
+ // bundleName:
// bundle name, i.e. the filename without the '.js' suffix. Using "nls" as a
// a bundle name is not supported, since "nls" is the name of the folder
// that holds bundles. Using "nls" as the bundle name will cause problems
// with the custom build.
//
- // locale:
+ // locale:
// the locale to load (optional) By default, the browser's user
// locale as defined by dojo.locale
//
- // availableFlatLocales:
+ // availableFlatLocales:
// A comma-separated list of the available, flattened locales for this
// bundle. This argument should only be set by the build process.
//
@@ -644,11 +653,11 @@ dojo._hasResource["dojo.foo"] = true;
ire = new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");
dojo._Url = function(/*dojo._Url|String...*/){
- // summary:
+ // summary:
// Constructor to create an object representing a URL.
// It is marked as private, since we might consider removing
// or simplifying it.
- // description:
+ // description:
// Each argument is evaluated in order relative to the next until
// a canonical uri is produced. To get an absolute Uri relative to
// the current document use:
@@ -715,7 +724,7 @@ dojo._hasResource["dojo.foo"] = true;
}
uri = [];
- if(relobj.scheme){
+ if(relobj.scheme){
uri.push(relobj.scheme, ":");
}
if(relobj.authority){
@@ -755,7 +764,7 @@ dojo._hasResource["dojo.foo"] = true;
dojo._Url.prototype.toString = function(){ return this.uri; };
dojo.moduleUrl = function(/*String*/module, /*dojo._Url||String*/url){
- // summary:
+ // summary:
// Returns a `dojo._Url` object relative to a module.
// example:
// | var pngPath = dojo.moduleUrl("acme","images/small.png");
@@ -763,10 +772,10 @@ dojo._hasResource["dojo.foo"] = true;
// | // create an image and set it's source to pngPath's value:
// | var img = document.createElement("img");
// | // NOTE: we assign the string representation of the url object
- // | img.src = pngPath.toString();
+ // | img.src = pngPath.toString();
// | // add our image to the document
// | dojo.body().appendChild(img);
- // example:
+ // example:
// you may de-reference as far as you like down the package
// hierarchy. This is sometimes handy to avoid lenghty relative
// urls or for building portable sub-packages. In this example,
@@ -777,9 +786,9 @@ dojo._hasResource["dojo.foo"] = true;
// | // somewhere in a configuration block
// | dojo.registerModulePath("acme.widget", "../../acme/widget");
// | dojo.registerModulePath("acme.util", "../../util");
- // |
+ // |
// | // ...
- // |
+ // |
// | // code in a module using acme resources
// | var tmpltPath = dojo.moduleUrl("acme.widget","templates/template.html");
// | var dataPath = dojo.moduleUrl("acme.util","resources/data.json");
@@ -798,7 +807,10 @@ dojo._hasResource["dojo.foo"] = true;
}
return new d._Url(loc, url); // dojo._Url
- }
+ };
+
+
+
})();
}
diff --git a/lib/dojo/_base/_loader/loader_debug.js b/lib/dojo/_base/_loader/loader_debug.js
index fa26d8efb..f2043e4de 100644
--- a/lib/dojo/_base/_loader/loader_debug.js
+++ b/lib/dojo/_base/_loader/loader_debug.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
diff --git a/lib/dojo/_base/_loader/loader_xd.js b/lib/dojo/_base/_loader/loader_xd.js
index c60b86b05..e59f814c0 100644
--- a/lib/dojo/_base/_loader/loader_xd.js
+++ b/lib/dojo/_base/_loader/loader_xd.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -170,23 +170,27 @@ dojo._xdIsXDomainPath = function(/*string*/relpath) {
var colonIndex = relpath.indexOf(":");
var slashIndex = relpath.indexOf("/");
- if(colonIndex > 0 && colonIndex < slashIndex){
+ if(colonIndex > 0 && colonIndex < slashIndex || relpath.indexOf("//") === 0){
return true;
}else{
//Is the base script URI-based URL a cross domain URL?
//If so, then the relpath will be evaluated relative to
//baseUrl, and therefore qualify as xdomain.
//Only treat it as xdomain if the page does not have a
- //host (file:// url) or if the baseUrl does not match the
- //current window's domain.
+ //host (file:// url), if the baseUrl does not match the
+ //current window's domain, or if the baseUrl starts with //.
+ //If baseUrl starts with // then it probably means that xdomain
+ //is wanted since it is such a specific path request. This is not completely robust,
+ //but something more robust would require normalizing the protocol on baseUrl and on the location
+ //to see if they differ. However, that requires more code, and // as a start path is unusual.
var url = dojo.baseUrl;
colonIndex = url.indexOf(":");
slashIndex = url.indexOf("/");
- if(colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0)){
+ if(url.indexOf("//") === 0 || (colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0))){
return true;
}
}
- return false;
+ return false;
}
dojo._loadPath = function(/*String*/relpath, /*String?*/module, /*Function?*/cb){
@@ -218,8 +222,8 @@ dojo._loadUri = function(/*String*/uri, /*Function?*/cb, /*boolean*/currentIsXDo
}
//Add the module (resource) to the list of modules.
- //Only do this work if we have a modlue name. Otherwise,
- //it is a non-xd i18n bundle, which can load immediately and does not
+ //Only do this work if we have a modlue name. Otherwise,
+ //it is a non-xd i18n bundle, which can load immediately and does not
//need to be tracked. Also, don't track dojo.i18n, since it is a prerequisite
//and will be loaded correctly if we load it right away: it has no dependencies.
if(dojo._isXDomain && module && module != "dojo.i18n"){
@@ -386,7 +390,7 @@ dojo._xdResourceLoaded = function(/*Object*/res){
}
//Now update the inflight status for any provided resources in this loaded resource.
- //Do this at the very end (in a *separate* for loop) to avoid shutting down the
+ //Do this at the very end (in a *separate* for loop) to avoid shutting down the
//inflight timer check too soon.
for(i = 0; i < provideList.length; i++){
dojo._xdInFlight[provideList[i]] = false;
@@ -490,7 +494,7 @@ dojo.xdRequireLocalization = function(/*String*/moduleName, /*String*/bundleName
// Replace dojo.requireLocalization with a wrapper
dojo._xdRealRequireLocalization = dojo.requireLocalization;
dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String*/availableFlatLocales){
- // summary: loads a bundle intelligently based on whether the module is
+ // summary: loads a bundle intelligently based on whether the module is
// local or xd. Overrides the local-case implementation.
var modulePath = dojo.moduleUrl(moduleName).toString();
@@ -525,7 +529,7 @@ dojo._xdUnpackDependency = function(/*Array*/dep){
case "platformRequire":
var modMap = dep[1];
var common = modMap["common"]||[];
- newDeps = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
+ newDeps = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
//Flatten the array of arrays into a one-level deep array.
//Each result could be an array of 3 elements (the 3 arguments to dojo.require).
//We only need the first one.
@@ -562,7 +566,7 @@ dojo._xdUnpackDependency = function(/*Array*/dep){
}
dojo._xdWalkReqs = function(){
- //summary: Internal xd loader function.
+ //summary: Internal xd loader function.
//Walks the requires and evaluates module resource contents in
//the right order.
var reqChain = null;
@@ -578,7 +582,7 @@ dojo._xdWalkReqs = function(){
}
dojo._xdEvalReqs = function(/*Array*/reqChain){
- //summary: Internal xd loader function.
+ //summary: Internal xd loader function.
//Does a depth first, breadth second search and eval of required modules.
while(reqChain.length > 0){
var req = reqChain[reqChain.length - 1];
@@ -673,7 +677,7 @@ dojo._xdWatchInFlight = function(){
dojo._xdDebugQueue.push({resourceName: content.resourceName, resourcePath: content.resourcePath});
}else{
//Evaluate the resource to bring it into being.
- //Pass in scope args to allow multiple versions of modules in a page.
+ //Pass in scope args to allow multiple versions of modules in a page.
content.apply(dojo.global, dojo._scopeArgs);
}
}
@@ -685,7 +689,7 @@ dojo._xdWatchInFlight = function(){
for(i = 0; i < dojo._xdContents.length; i++){
var current = dojo._xdContents[i];
if(current.content && !current.isDefined){
- //Pass in scope args to allow multiple versions of modules in a page.
+ //Pass in scope args to allow multiple versions of modules in a page.
current.content.apply(dojo.global, dojo._scopeArgs);
}
}
@@ -712,10 +716,10 @@ dojo._xdNotifyLoaded = function(){
}
}
- dojo._inFlightCount = 0;
+ dojo._inFlightCount = 0;
- //Only trigger call loaded if dj_load_init has run.
- if(dojo._initFired && !dojo._loadNotifying){
+ //Only trigger call loaded if dj_load_init has run.
+ if(dojo._initFired && !dojo._loadNotifying){
dojo._callLoaded();
}
}
diff --git a/lib/dojo/_base/array.js b/lib/dojo/_base/array.js
index 26fa1900d..57cea4229 100644
--- a/lib/dojo/_base/array.js
+++ b/lib/dojo/_base/array.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -7,13 +7,14 @@
if(!dojo._hasResource["dojo._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.array"] = true;
-dojo.require("dojo._base.lang");
dojo.provide("dojo._base.array");
+dojo.require("dojo._base.lang");
+
(function(){
var _getParts = function(arr, obj, cb){
- return [
- (typeof arr == "string") ? arr.split("") : arr,
+ return [
+ (typeof arr == "string") ? arr.split("") : arr,
obj || dojo.global,
// FIXME: cache the anonymous functions we create here?
(typeof cb == "string") ? new Function("item", "index", "array", cb) : cb
@@ -32,7 +33,7 @@ dojo.provide("dojo._base.array");
};
dojo.mixin(dojo, {
- indexOf: function( /*Array*/ array,
+ indexOf: function( /*Array*/ array,
/*Object*/ value,
/*Integer?*/ fromIndex,
/*Boolean?*/ findLast){
@@ -41,7 +42,7 @@ dojo.provide("dojo._base.array");
// passed array. If the value is not found, -1 is returned.
// description:
// This method corresponds to the JavaScript 1.6 Array.indexOf method, with one difference: when
- // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
+ // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
// 1.6's indexOf skips the holes in the sparse array.
// For details on this method, see:
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf
@@ -66,7 +67,7 @@ dojo.provide("dojo._base.array");
// array. If the value is not found, -1 is returned.
// description:
// This method corresponds to the JavaScript 1.6 Array.lastIndexOf method, with one difference: when
- // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
+ // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
// 1.6's lastIndexOf skips the holes in the sparse array.
// For details on this method, see:
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/lastIndexOf
@@ -85,7 +86,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's forEach skips the holes in the sparse array.
// For more details, see:
@@ -108,21 +109,21 @@ dojo.provide("dojo._base.array");
// | );
// example:
// | // use a scoped object member as the callback
- // |
+ // |
// | var obj = {
- // | prefix: "logged via obj.callback:",
+ // | prefix: "logged via obj.callback:",
// | callback: function(item){
// | console.log(this.prefix, item);
// | }
// | };
- // |
+ // |
// | // specifying the scope function executes the callback in that scope
// | dojo.forEach(
// | [ "thinger", "blah", "howdy", 10 ],
// | obj.callback,
// | obj
// | );
- // |
+ // |
// | // alternately, we can accomplish the same thing with dojo.hitch()
// | dojo.forEach(
// | [ "thinger", "blah", "howdy", 10 ],
@@ -135,7 +136,7 @@ dojo.provide("dojo._base.array");
// FIXME: there are several ways of handilng thisObject. Is
// dojo.global always the default context?
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
- for(var i=0,l=arr.length; i1; });
// example:
- // | // returns true
+ // | // returns true
// | dojo.every([1, 2, 3, 4], function(item){ return item>0; });
return everyOrSome(true, arr, callback, thisObject); // Boolean
},
@@ -178,7 +179,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's some skips the holes in the sparse array.
// For more details, see:
@@ -205,7 +206,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
// the callback function with a value of undefined. JavaScript 1.6's map skips the holes in the sparse array.
// For more details, see:
@@ -236,9 +237,9 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
+ // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
- // the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
+ // the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
// For more details, see:
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
// example:
diff --git a/lib/dojo/_base/browser.js b/lib/dojo/_base/browser.js
index 496fe46b3..209330f0d 100644
--- a/lib/dojo/_base/browser.js
+++ b/lib/dojo/_base/browser.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -8,7 +8,6 @@
if(!dojo._hasResource["dojo._base.browser"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.browser"] = true;
dojo.provide("dojo._base.browser");
-
dojo.require("dojo._base.window");
dojo.require("dojo._base.connect");
dojo.require("dojo._base.event");
@@ -18,12 +17,12 @@ dojo.require("dojo._base.query");
dojo.require("dojo._base.xhr");
dojo.require("dojo._base.fx");
-//Need this to be the last code segment in base, so do not place any
-//dojo.requireIf calls in this file. Otherwise, due to how the build system
-//puts all requireIf dependencies after the current file, the require calls
-//could be called before all of base is defined.
-dojo.forEach(dojo.config.require, function(i){
- dojo["require"](i);
-});
+ //Need this to be the last code segment in base, so do not place any
+ //dojo/requireIf calls in this file/ Otherwise, due to how the build system
+ //puts all requireIf dependencies after the current file, the require calls
+ //could be called before all of base is defined/
+ dojo.forEach(dojo.config.require, function(i){
+ dojo["require"](i);
+ });
}
diff --git a/lib/dojo/_base/connect.js b/lib/dojo/_base/connect.js
index f37af65b2..7e8006221 100644
--- a/lib/dojo/_base/connect.js
+++ b/lib/dojo/_base/connect.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,27 +10,28 @@ dojo._hasResource["dojo._base.connect"] = true;
dojo.provide("dojo._base.connect");
dojo.require("dojo._base.lang");
+
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
// low-level delegation machinery
dojo._listener = {
// create a dispatcher function
getDispatcher: function(){
- // following comments pulled out-of-line to prevent cloning them
+ // following comments pulled out-of-line to prevent cloning them
// in the returned function.
- // - indices (i) that are really in the array of listeners (ls) will
+ // - indices (i) that are really in the array of listeners (ls) will
// not be in Array.prototype. This is the 'sparse array' trick
- // that keeps us safe from libs that take liberties with built-in
+ // that keeps us safe from libs that take liberties with built-in
// objects
// - listener is invoked with current scope (this)
return function(){
- var ap=Array.prototype, c=arguments.callee, ls=c._listeners, t=c.target;
+ var ap = Array.prototype, c = arguments.callee, ls = c._listeners, t = c.target,
// return value comes from original target function
- var r = t && t.apply(this, arguments);
+ r = t && t.apply(this, arguments),
// make local copy of listener array so it is immutable during processing
- var i, lls;
- lls = [].concat(ls);
-
+ i, lls = [].concat(ls)
+ ;
+
// invoke listeners after target function
for(i in lls){
if(!(i in ap)){
@@ -44,12 +45,12 @@ dojo._listener = {
// add a listener to an object
add: function(/*Object*/ source, /*String*/ method, /*Function*/ listener){
// Whenever 'method' is invoked, 'listener' will have the same scope.
- // Trying to supporting a context object for the listener led to
- // complexity.
+ // Trying to supporting a context object for the listener led to
+ // complexity.
// Non trivial to provide 'once' functionality here
// because listener could be the result of a dojo.hitch call,
// in which case two references to the same hitch target would not
- // be equivalent.
+ // be equivalent.
source = source || dojo.global;
// The source method is either null, a dispatcher, or some other function
var f = source[method];
@@ -59,15 +60,15 @@ dojo._listener = {
// original target function is special
d.target = f;
// dispatcher holds a list of listeners
- d._listeners = [];
+ d._listeners = [];
// redirect source to dispatcher
f = source[method] = d;
}
- // The contract is that a handle is returned that can
- // identify this listener for disconnect.
+ // The contract is that a handle is returned that can
+ // identify this listener for disconnect.
//
- // The type of the handle is private. Here is it implemented as Integer.
- // DOM event code has this same contract but handle is Function
+ // The type of the handle is private. Here is it implemented as Integer.
+ // DOM event code has this same contract but handle is Function
// in non-IE browsers.
//
// We could have separate lists of before and after listeners.
@@ -89,9 +90,9 @@ dojo._listener = {
// and dontFix argument here to help the autodocs. Actual DOM aware code is in
// event.js.
-dojo.connect = function(/*Object|null*/ obj,
- /*String*/ event,
- /*Object|null*/ context,
+dojo.connect = function(/*Object|null*/ obj,
+ /*String*/ event,
+ /*Object|null*/ context,
/*String|Function*/ method,
/*Boolean?*/ dontFix){
// summary:
@@ -126,37 +127,37 @@ dojo.connect = function(/*Object|null*/ obj,
// arguments may simply be omitted such that fewer than 4 arguments
// may be required to set up a connection See the examples for details.
//
- // The return value is a handle that is needed to
+ // The return value is a handle that is needed to
// remove this connection with `dojo.disconnect`.
//
- // obj:
- // The source object for the event function.
+ // obj:
+ // The source object for the event function.
// Defaults to `dojo.global` if null.
- // If obj is a DOM node, the connection is delegated
+ // If obj is a DOM node, the connection is delegated
// to the DOM event manager (unless dontFix is true).
//
// event:
- // String name of the event function in obj.
+ // String name of the event function in obj.
// I.e. identifies a property `obj[event]`.
//
- // context:
+ // context:
// The object that method will receive as "this".
//
// If context is null and method is a function, then method
// inherits the context of event.
- //
- // If method is a string then context must be the source
+ //
+ // If method is a string then context must be the source
// object object for method (context[method]). If context is null,
// dojo.global is used.
//
// method:
- // A function reference, or name of a function in context.
- // The function identified by method fires after event does.
+ // A function reference, or name of a function in context.
+ // The function identified by method fires after event does.
// method receives the same arguments as the event.
// See context argument comments for information on method's scope.
//
// dontFix:
- // If obj is a DOM node, set dontFix to true to prevent delegation
+ // If obj is a DOM node, set dontFix to true to prevent delegation
// of this connection to the DOM event manager.
//
// example:
@@ -206,9 +207,9 @@ dojo.connect = function(/*Object|null*/ obj,
// used by non-browser hostenvs. always overriden by event.js
dojo._connect = function(obj, event, context, method){
- var l=dojo._listener, h=l.add(obj, event, dojo.hitch(context, method));
+ var l=dojo._listener, h=l.add(obj, event, dojo.hitch(context, method));
return [obj, event, h, l]; // Handle
-}
+};
dojo.disconnect = function(/*Handle*/ handle){
// summary:
@@ -222,11 +223,11 @@ dojo.disconnect = function(/*Handle*/ handle){
// let's not keep this reference
delete handle[0];
}
-}
+};
dojo._disconnect = function(obj, event, handle, listener){
listener.remove(obj, event, handle);
-}
+};
// topic publish/subscribe
@@ -244,15 +245,15 @@ dojo.subscribe = function(/*String*/ topic, /*Object|null*/ context, /*String|Fu
// is invoked when topic is published.
// example:
// | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); });
- // | dojo.publish("alerts", [ "read this", "hello world" ]);
+ // | dojo.publish("alerts", [ "read this", "hello world" ]);
// support for 2 argument invocation (omitting context) depends on hitch
return [topic, dojo._listener.add(dojo._topics, topic, dojo.hitch(context, method))]; /*Handle*/
-}
+};
dojo.unsubscribe = function(/*Handle*/ handle){
// summary:
- // Remove a topic listener.
+ // Remove a topic listener.
// handle:
// The handle returned from a call to subscribe.
// example:
@@ -262,7 +263,7 @@ dojo.unsubscribe = function(/*Handle*/ handle){
if(handle){
dojo._listener.remove(dojo._topics, handle[0], handle[1]);
}
-}
+};
dojo.publish = function(/*String*/ topic, /*Array*/ args){
// summary:
@@ -270,11 +271,11 @@ dojo.publish = function(/*String*/ topic, /*Array*/ args){
// topic:
// The name of the topic to publish.
// args:
- // An array of arguments. The arguments will be applied
+ // An array of arguments. The arguments will be applied
// to each topic subscriber (as first class parameters, via apply).
// example:
// | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
- // | dojo.publish("alerts", [ "read this", "hello world" ]);
+ // | dojo.publish("alerts", [ "read this", "hello world" ]);
// Note that args is an array, which is more efficient vs variable length
// argument list. Ideally, var args would be implemented via Array
@@ -283,10 +284,10 @@ dojo.publish = function(/*String*/ topic, /*Array*/ args){
if(f){
f.apply(this, args||[]);
}
-}
+};
-dojo.connectPublisher = function( /*String*/ topic,
- /*Object|null*/ obj,
+dojo.connectPublisher = function( /*String*/ topic,
+ /*Object|null*/ obj,
/*String*/ event){
// summary:
// Ensure that every time obj.event() is called, a message is published
@@ -295,11 +296,11 @@ dojo.connectPublisher = function( /*String*/ topic,
// the topic.
// topic:
// The name of the topic to publish.
- // obj:
+ // obj:
// The source object for the event function. Defaults to dojo.global
// if null.
// event:
- // The name of the event function in obj.
+ // The name of the event function in obj.
// I.e. identifies a property obj[event].
// example:
// | dojo.connectPublisher("/ajax/start", dojo, "xhrGet");
diff --git a/lib/dojo/_base/declare.js b/lib/dojo/_base/declare.js
index 8e46b12c0..437914870 100644
--- a/lib/dojo/_base/declare.js
+++ b/lib/dojo/_base/declare.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -8,18 +8,18 @@
if(!dojo._hasResource["dojo._base.declare"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.declare"] = true;
dojo.provide("dojo._base.declare");
-
dojo.require("dojo._base.lang");
dojo.require("dojo._base.array");
+
(function(){
var d = dojo, mix = d._mixin, op = Object.prototype, opts = op.toString,
xtor = new Function, counter = 0, cname = "constructor";
- function err(msg){ throw new Error("declare: " + msg); }
+ function err(msg, cls){ throw new Error("declare" + (cls ? " " + cls : "") + ": " + msg); }
// C3 Method Resolution Order (see http://www.python.org/download/releases/2.3/mro/)
- function c3mro(bases){
+ function c3mro(bases, className){
var result = [], roots = [{cls: 0, refs: []}], nameMap = {}, clsCount = 1,
l = bases.length, i = 0, j, lin, base, top, proto, rec, name, refs;
@@ -27,9 +27,9 @@ dojo.require("dojo._base.array");
for(; i < l; ++i){
base = bases[i];
if(!base){
- err("mixin #" + i + " is unknown. Did you use dojo.require to pull it in?");
+ err("mixin #" + i + " is unknown. Did you use dojo.require to pull it in?", className);
}else if(opts.call(base) != "[object Function]"){
- err("mixin #" + i + " is not a callable constructor.");
+ err("mixin #" + i + " is not a callable constructor.", className);
}
lin = base._meta ? base._meta.bases : [base];
top = 0;
@@ -82,7 +82,7 @@ dojo.require("dojo._base.array");
}
}
if(clsCount){
- err("can't build consistent linearization");
+ err("can't build consistent linearization", className);
}
// calculate the superclass offset
@@ -109,7 +109,7 @@ dojo.require("dojo._base.array");
caller = args.callee;
name = name || caller.nom;
if(!name){
- err("can't deduce a name to call inherited()");
+ err("can't deduce a name to call inherited()", this.declaredClass);
}
meta = this.constructor._meta;
@@ -127,7 +127,7 @@ dojo.require("dojo._base.array");
// error detection
chains = meta.chains;
if(chains && typeof chains[name] == "string"){
- err("calling chained method with inherited: " + name);
+ err("calling chained method with inherited: " + name, this.declaredClass);
}
// find caller
do{
@@ -168,7 +168,7 @@ dojo.require("dojo._base.array");
// error detection
chains = meta.chains;
if(!chains || chains.constructor !== "manual"){
- err("calling chained constructor with inherited");
+ err("calling chained constructor with inherited", this.declaredClass);
}
// find caller
while(base = bases[++pos]){ // intentional assignment
@@ -464,7 +464,7 @@ dojo.require("dojo._base.array");
// build a prototype
if(opts.call(superclass) == "[object Array]"){
// C3 MRO
- bases = c3mro(superclass);
+ bases = c3mro(superclass, className);
t = bases[0];
mixins = bases.length - t;
superclass = bases[mixins];
@@ -475,10 +475,10 @@ dojo.require("dojo._base.array");
t = superclass._meta;
bases = bases.concat(t ? t.bases : superclass);
}else{
- err("base class is not a callable constructor.");
+ err("base class is not a callable constructor.", className);
}
}else if(superclass !== null){
- err("unknown base class. Did you use dojo.require to pull it in?")
+ err("unknown base class. Did you use dojo.require to pull it in?", className);
}
}
if(superclass){
diff --git a/lib/dojo/_base/event.js b/lib/dojo/_base/event.js
index 5268c6cff..65239bf50 100644
--- a/lib/dojo/_base/event.js
+++ b/lib/dojo/_base/event.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -10,27 +10,26 @@ dojo._hasResource["dojo._base.event"] = true;
dojo.provide("dojo._base.event");
dojo.require("dojo._base.connect");
+
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
(function(){
// DOM event listener machinery
var del = (dojo._event_listener = {
add: function(/*DOMNode*/ node, /*String*/ name, /*Function*/ fp){
- if(!node){return;}
+ if(!node){return;}
name = del._normalizeEventName(name);
fp = del._fixCallback(name, fp);
- var oname = name;
if(
- !dojo.isIE &&
+ !dojo.isIE &&
(name == "mouseenter" || name == "mouseleave")
){
var ofp = fp;
- //oname = name;
name = (name == "mouseenter") ? "mouseover" : "mouseout";
fp = function(e){
if(!dojo.isDescendant(e.relatedTarget, node)){
// e.type = oname; // FIXME: doesn't take? SJM: event.type is generally immutable.
- return ofp.call(this, e);
+ return ofp.call(this, e);
}
}
}
@@ -71,7 +70,7 @@ dojo.require("dojo._base.connect");
},
_fixEvent: function(evt, sender){
// _fixCallback only attaches us to keypress.
- // Switch on evt.type anyway because we might
+ // Switch on evt.type anyway because we might
// be called directly from dojo.fixEvent.
switch(evt.type){
case "keypress":
@@ -81,26 +80,26 @@ dojo.require("dojo._base.connect");
return evt;
},
_setKeyChar: function(evt){
- evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
+ evt.keyChar = evt.charCode >= 32 ? String.fromCharCode(evt.charCode) : '';
evt.charOrCode = evt.keyChar || evt.keyCode;
},
// For IE and Safari: some ctrl-key combinations (mostly w/punctuation) do not emit a char code in IE
// we map those virtual key codes to ascii here
// not valid for all (non-US) keyboards, so maybe we shouldn't bother
- _punctMap: {
- 106:42,
- 111:47,
- 186:59,
- 187:43,
- 188:44,
- 189:45,
- 190:46,
- 191:47,
- 192:96,
- 219:91,
- 220:92,
- 221:93,
- 222:39
+ _punctMap: {
+ 106:42,
+ 111:47,
+ 186:59,
+ 187:43,
+ 188:44,
+ 189:45,
+ 190:46,
+ 191:47,
+ 192:96,
+ 219:91,
+ 220:92,
+ 221:93,
+ 222:39
}
});
@@ -115,7 +114,7 @@ dojo.require("dojo._base.connect");
// sender: DOMNode
// node to treat as "currentTarget"
return del._fixEvent(evt, sender);
- }
+ };
dojo.stopEvent = function(/*Event*/ evt){
// summary:
@@ -126,7 +125,7 @@ dojo.require("dojo._base.connect");
evt.preventDefault();
evt.stopPropagation();
// NOTE: below, this method is overridden for IE
- }
+ };
// the default listener to use on dontFix nodes, overriden for IE
var node_listener = dojo._listener;
@@ -141,16 +140,16 @@ dojo.require("dojo._base.connect");
// create a listener
var h = l.add(obj, event, dojo.hitch(context, method));
// formerly, the disconnect package contained "l" directly, but if client code
- // leaks the disconnect package (by connecting it to a node), referencing "l"
+ // leaks the disconnect package (by connecting it to a node), referencing "l"
// compounds the problem.
// instead we return a listener id, which requires custom _disconnect below.
// return disconnect package
return [ obj, event, h, lid ];
- }
+ };
dojo._disconnect = function(obj, event, handle, listener){
([dojo._listener, del, node_listener][listener]).remove(obj, event, handle);
- }
+ };
// Constants
@@ -280,7 +279,7 @@ dojo.require("dojo._base.connect");
};
=====*/
- if(dojo.isIE){
+ if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
dojo.mouseButtons = {
LEFT: 1,
MIDDLE: 4,
@@ -305,7 +304,7 @@ dojo.require("dojo._base.connect");
}
// IE event normalization
- if(dojo.isIE){
+ if(dojo.isIE){
var _trySetKeyCode = function(e, code){
try{
// squelch errors when keyCode is read-only
@@ -314,7 +313,7 @@ dojo.require("dojo._base.connect");
}catch(e){
return 0;
}
- }
+ };
// by default, use the standard listener
var iel = dojo._listener;
@@ -323,7 +322,7 @@ dojo.require("dojo._base.connect");
if(!dojo.config._allow_leaks){
// custom listener that handles leak protection for DOM events
node_listener = iel = dojo._ie_listener = {
- // support handler indirection: event handler functions are
+ // support handler indirection: event handler functions are
// referenced here. Event dispatchers hold only indices.
handlers: [],
// add a listener to an object
@@ -376,7 +375,7 @@ dojo.require("dojo._base.connect");
},
remove: function(/*DOMNode*/ node, /*String*/ event, /*Handle*/ handle){
event = del._normalizeEventName(event);
- iel.remove(node, event, handle);
+ iel.remove(node, event, handle);
if(event=="onkeypress"){
var kd = node.onkeydown;
if(--kd._stealthKeydownRefs <= 0){
@@ -402,11 +401,11 @@ dojo.require("dojo._base.connect");
// node to treat as "currentTarget"
if(!evt){
var w = sender && (sender.ownerDocument || sender.document || sender).parentWindow || window;
- evt = w.event;
+ evt = w.event;
}
if(!evt){return(evt);}
- evt.target = evt.srcElement;
- evt.currentTarget = (sender || evt.srcElement);
+ evt.target = evt.srcElement;
+ evt.currentTarget = (sender || evt.srcElement);
evt.layerX = evt.offsetX;
evt.layerY = evt.offsetY;
// FIXME: scroll position query is duped from dojo.html to
@@ -419,14 +418,16 @@ dojo.require("dojo._base.connect");
var offset = dojo._getIeDocumentElementOffset();
evt.pageX = evt.clientX + dojo._fixIeBiDiScrollLeft(docBody.scrollLeft || 0) - offset.x;
evt.pageY = evt.clientY + (docBody.scrollTop || 0) - offset.y;
- if(evt.type == "mouseover"){
+ if(evt.type == "mouseover"){
evt.relatedTarget = evt.fromElement;
}
- if(evt.type == "mouseout"){
+ if(evt.type == "mouseout"){
evt.relatedTarget = evt.toElement;
}
- evt.stopPropagation = del._stopPropagation;
- evt.preventDefault = del._preventDefault;
+ if (dojo.isIE < 9 || dojo.isQuirks) {
+ evt.stopPropagation = del._stopPropagation;
+ evt.preventDefault = del._preventDefault;
+ }
return del._fixKeys(evt);
},
_fixKeys: function(evt){
@@ -460,38 +461,41 @@ dojo.require("dojo._base.connect");
var k=evt.keyCode;
// These are Windows Virtual Key Codes
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
- var unprintable = k!=13 && k!=32 && k!=27 && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222);
+ var unprintable = (k!=13 || (dojo.isIE >= 9 && !dojo.isQuirks)) && k!=32 && k!=27 && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222);
+
// synthesize keypress for most unprintables and CTRL-keys
if(unprintable||evt.ctrlKey){
var c = unprintable ? 0 : k;
if(evt.ctrlKey){
if(k==3 || k==13){
- return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
- }else if(c>95 && c<106){
+ return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
+ }else if(c>95 && c<106){
c -= 48; // map CTRL-[numpad 0-9] to ASCII
- }else if((!evt.shiftKey)&&(c>=65&&c<=90)){
+ }else if((!evt.shiftKey)&&(c>=65&&c<=90)){
c += 32; // map CTRL-[A-Z] to lowercase
- }else{
+ }else{
c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
}
}
// simulate a keypress event
var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
kp.call(evt.currentTarget, faux);
- evt.cancelBubble = faux.cancelBubble;
+ if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
+ evt.cancelBubble = faux.cancelBubble;
+ }
evt.returnValue = faux.returnValue;
_trySetKeyCode(evt, faux.keyCode);
}
},
// Called in Event scope
_stopPropagation: function(){
- this.cancelBubble = true;
+ this.cancelBubble = true;
},
_preventDefault: function(){
// Setting keyCode to 0 is the only way to prevent certain keypresses (namely
// ctrl-combinations that correspond to menu accelerator keys).
// Otoh, it prevents upstream listeners from getting this information
- // Try to split the difference here by clobbering keyCode only for ctrl
+ // Try to split the difference here by clobbering keyCode only for ctrl
// combinations. If you still need to access the key upstream, bubbledKeyCode is
// provided as a workaround.
this.bubbledKeyCode = this.keyCode;
@@ -501,23 +505,23 @@ dojo.require("dojo._base.connect");
});
// override stopEvent for IE
- dojo.stopEvent = function(evt){
+ dojo.stopEvent = (dojo.isIE < 9 || dojo.isQuirks) ? function(evt){
evt = evt || window.event;
del._stopPropagation.call(evt);
del._preventDefault.call(evt);
- }
+ } : dojo.stopEvent;
}
del._synthesizeEvent = function(evt, props){
var faux = dojo.mixin({}, evt, props);
del._setKeyChar(faux);
- // FIXME: would prefer to use dojo.hitch: dojo.hitch(evt, evt.preventDefault);
+ // FIXME: would prefer to use dojo.hitch: dojo.hitch(evt, evt.preventDefault);
// but it throws an error when preventDefault is invoked on Safari
// does Event.preventDefault not support "apply" on Safari?
- faux.preventDefault = function(){ evt.preventDefault(); };
- faux.stopPropagation = function(){ evt.stopPropagation(); };
+ faux.preventDefault = function(){ evt.preventDefault(); };
+ faux.stopPropagation = function(){ evt.stopPropagation(); };
return faux;
- }
+ };
// Opera event normalization
if(dojo.isOpera){
@@ -568,12 +572,12 @@ dojo.require("dojo._base.connect");
var c = unprintable ? 0 : k;
if(evt.ctrlKey){
if(k==3 || k==13){
- return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
- }else if(c>95 && c<106){
+ return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
+ }else if(c>95 && c<106){
c -= 48; // map CTRL-[numpad 0-9] to ASCII
- }else if(!evt.shiftKey && c>=65 && c<=90){
+ }else if(!evt.shiftKey && c>=65 && c<=90){
c += 32; // map CTRL-[A-Z] to lowercase
- }else{
+ }else{
c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
}
}
@@ -630,16 +634,16 @@ if(dojo.isIE){
}
}
return r;
- }
+ };
dojo._getIeDispatcher = function(){
// ensure the returned function closes over nothing ("new Function" apparently doesn't close)
return new Function(dojo._scopeName + "._ieDispatcher(arguments, this)"); // function
- }
+ };
// keep this out of the closure to reduce RAM allocation
dojo._event_listener._fixCallback = function(fp){
var f = dojo._event_listener._fixEvent;
return function(e){ return fp.call(this, f(e, this)); };
- }
+ };
}
}
diff --git a/lib/dojo/_base/fx.js b/lib/dojo/_base/fx.js
index 21243c1c9..860e0e18b 100644
--- a/lib/dojo/_base/fx.js
+++ b/lib/dojo/_base/fx.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -13,6 +13,7 @@ dojo.require("dojo._base.connect");
dojo.require("dojo._base.lang");
dojo.require("dojo._base.html");
+
/*
Animation loosely package based on Dan Pupius' work, contributed under CLA:
http://pupius.co.uk/js/Toolkit.Drawing.js
diff --git a/lib/dojo/_base/html.js b/lib/dojo/_base/html.js
index be5fd2aaa..8661b2b12 100644
--- a/lib/dojo/_base/html.js
+++ b/lib/dojo/_base/html.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -7,8 +7,9 @@
if(!dojo._hasResource["dojo._base.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.html"] = true;
-dojo.require("dojo._base.lang");
dojo.provide("dojo._base.html");
+dojo.require("dojo._base.lang");
+
// FIXME: need to add unit tests for all the semi-public methods
@@ -53,13 +54,13 @@ dojo.byId = function(id, doc){
// | }
=====*/
-if(dojo.isIE || dojo.isOpera){
+if(dojo.isIE){
dojo.byId = function(id, doc){
if(typeof id != "string"){
return id;
}
var _d = doc || dojo.doc, te = _d.getElementById(id);
- // attributes.id.value is better than just id in case the
+ // attributes.id.value is better than just id in case the
// user has a name=id inside a form
if(te && (te.attributes.id.value == id || te.id == id)){
return te;
@@ -80,8 +81,9 @@ if(dojo.isIE || dojo.isOpera){
};
}else{
dojo.byId = function(id, doc){
- // inline'd type check
- return (typeof id == "string") ? (doc || dojo.doc).getElementById(id) : id; // DomNode
+ // inline'd type check.
+ // be sure to return null per documentation, to match IE branch.
+ return ((typeof id == "string") ? (doc || dojo.doc).getElementById(id) : id) || null; // DomNode
};
}
/*=====
@@ -164,16 +166,16 @@ if(dojo.isIE || dojo.isOpera){
};
dojo.setSelectable = function(/*DomNode|String*/node, /*Boolean*/selectable){
- // summary:
+ // summary:
// Enable or disable selection on a node
// node:
// id or reference to node
// selectable:
- // state to put the node in. false indicates unselectable, true
+ // state to put the node in. false indicates unselectable, true
// allows selection.
// example:
// Make the node id="bar" unselectable
- // | dojo.setSelectable("bar");
+ // | dojo.setSelectable("bar");
// example:
// Make the node id="bar" selectable
// | dojo.setSelectable("bar", true);
@@ -256,7 +258,7 @@ if(dojo.isIE || dojo.isOpera){
refNode = byId(refNode);
if(typeof node == "string"){ // inline'd type check
- node = node.charAt(0) == "<" ? d._toDom(node, refNode.ownerDocument) : byId(node);
+ node = /^\s*= 0){ s.width = w + u; }
if(h >= 0){ s.height = h + u; }
- }
+ };
dojo._isButtonTag = function(/*DomNode*/node) {
// summary:
// True if the node is BUTTON or INPUT.type="button".
return node.tagName == "BUTTON"
|| node.tagName=="INPUT" && (node.getAttribute("type")||'').toUpperCase() == "BUTTON"; // boolean
- }
+ };
dojo._usesBorderBox = function(/*DomNode*/node){
// summary:
@@ -898,7 +914,7 @@ if(dojo.isIE || dojo.isOpera){
var n = node.tagName;
return d.boxModel=="border-box" || n=="TABLE" || d._isButtonTag(node); // boolean
- }
+ };
dojo._setContentSize = function(/*DomNode*/node, /*Number*/widthPx, /*Number*/heightPx, /*Object*/computedStyle){
// summary:
@@ -910,7 +926,7 @@ if(dojo.isIE || dojo.isOpera){
if(heightPx >= 0){ heightPx += pb.h; }
}
d._setBox(node, NaN, NaN, widthPx, heightPx);
- }
+ };
dojo._setMarginBox = function(/*DomNode*/node, /*Number?*/leftPx, /*Number?*/topPx,
/*Number?*/widthPx, /*Number?*/heightPx,
@@ -942,7 +958,7 @@ if(dojo.isIE || dojo.isOpera){
if(widthPx >= 0){ widthPx = Math.max(widthPx - pb.w - mb.w, 0); }
if(heightPx >= 0){ heightPx = Math.max(heightPx - pb.h - mb.h, 0); }
d._setBox(node, leftPx, topPx, widthPx, heightPx);
- }
+ };
var _nilExtents = { l:0, t:0, w:0, h:0 };
@@ -977,7 +993,7 @@ if(dojo.isIE || dojo.isOpera){
var n = byId(node), s = gcs(n), b = box;
return !b ? d._getMarginBox(n, s) : d._setMarginBox(n, b.l, b.t, b.w, b.h, s); // Object
- }
+ };
dojo.contentBox = function(/*DomNode|String*/node, /*Object?*/box){
// summary:
@@ -1002,14 +1018,14 @@ if(dojo.isIE || dojo.isOpera){
// All properties are optional if passed.
var n = byId(node), s = gcs(n), b = box;
return !b ? d._getContentBox(n, s) : d._setContentSize(n, b.w, b.h, s); // Object
- }
+ };
// =============================
- // Positioning
+ // Positioning
// =============================
var _sumAncestorProperties = function(node, prop){
- if(!(node = (node||0).parentNode)){return 0}
+ if(!(node = (node||0).parentNode)){return 0;}
var val, retVal = 0, _b = d.body();
while(node && node.style){
if(gcs(node).position == "fixed"){
@@ -1025,19 +1041,19 @@ if(dojo.isIE || dojo.isOpera){
node = node.parentNode;
}
return retVal; // integer
- }
+ };
dojo._docScroll = function(){
var n = d.global;
- return "pageXOffset" in n? { x:n.pageXOffset, y:n.pageYOffset } :
- (n=d.doc.documentElement, n.clientHeight? { x:d._fixIeBiDiScrollLeft(n.scrollLeft), y:n.scrollTop } :
- (n=d.body(), { x:n.scrollLeft||0, y:n.scrollTop||0 }));
+ return "pageXOffset" in n
+ ? { x:n.pageXOffset, y:n.pageYOffset }
+ : (n = d.isQuirks? d.doc.body : d.doc.documentElement, { x:d._fixIeBiDiScrollLeft(n.scrollLeft || 0), y:n.scrollTop || 0 });
};
dojo._isBodyLtr = function(){
return "_bodyLtr" in d? d._bodyLtr :
- d._bodyLtr = (d.body().dir || d.doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean
- }
+ d._bodyLtr = (d.body().dir || d.doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean
+ };
dojo._getIeDocumentElementOffset = function(){
// summary:
@@ -1058,7 +1074,7 @@ if(dojo.isIE || dojo.isOpera){
//NOTE: assumes we're being called in an IE browser
- var de = d.doc.documentElement; // only deal with HTML element here, _abs handles body/quirks
+ var de = d.doc.documentElement; // only deal with HTML element here, _abs handles body/quirks
if(d.isIE < 8){
var r = de.getBoundingClientRect(); // works well for IE6+
@@ -1083,18 +1099,22 @@ if(dojo.isIE || dojo.isOpera){
};
dojo._fixIeBiDiScrollLeft = function(/*Integer*/ scrollLeft){
- // In RTL direction, scrollLeft should be a negative value, but IE < 8
+ // In RTL direction, scrollLeft should be a negative value, but IE
// returns a positive one. All codes using documentElement.scrollLeft
// must call this function to fix this error, otherwise the position
// will offset to right when there is a horizontal scrollbar.
- var dd = d.doc;
- if(d.isIE < 8 && !d._isBodyLtr()){
- var de = d.isQuirks ? dd.body : dd.documentElement;
- return scrollLeft + de.clientWidth - de.scrollWidth; // Integer
+ var ie = d.isIE;
+ if(ie && !d._isBodyLtr()){
+ var qk = d.isQuirks,
+ de = qk ? d.doc.body : d.doc.documentElement;
+ if(ie == 6 && !qk && d.global.frameElement && de.scrollHeight > de.clientHeight){
+ scrollLeft += de.clientLeft; // workaround ie6+strict+rtl+iframe+vertical-scrollbar bug where clientWidth is too small by clientLeft pixels
+ }
+ return (ie < 8 || qk) ? (scrollLeft + de.clientWidth - de.scrollWidth) : -scrollLeft; // Integer
}
return scrollLeft; // Integer
- }
+ };
// FIXME: need a setter for coords or a moveTo!!
dojo._abs = dojo.position = function(/*DomNode*/node, /*Boolean?*/includeScroll){
@@ -1112,10 +1132,9 @@ if(dojo.isIE || dojo.isOpera){
// Uses the border-box model (inclusive of border and padding but
// not margin). Does not act as a setter.
- var db = d.body(), dh = db.parentNode, ret;
node = byId(node);
- if(node["getBoundingClientRect"]){
- // IE6+, FF3+, super-modern WebKit, and Opera 9.6+ all take this branch
+ var db = d.body(),
+ dh = db.parentNode,
ret = node.getBoundingClientRect();
ret = { x: ret.left, y: ret.top, w: ret.right - ret.left, h: ret.bottom - ret.top };
if(d.isIE){
@@ -1132,60 +1151,7 @@ if(dojo.isIE || dojo.isOpera){
ret.x -= px(dh, cs.marginLeft) + px(dh, cs.borderLeftWidth);
ret.y -= px(dh, cs.marginTop) + px(dh, cs.borderTopWidth);
}
- }else{
- // FF2 and older WebKit
- ret = {
- x: 0,
- y: 0,
- w: node.offsetWidth,
- h: node.offsetHeight
- };
- if(node["offsetParent"]){
- ret.x -= _sumAncestorProperties(node, "scrollLeft");
- ret.y -= _sumAncestorProperties(node, "scrollTop");
-
- var curnode = node;
- do{
- var n = curnode.offsetLeft,
- t = curnode.offsetTop;
- ret.x += isNaN(n) ? 0 : n;
- ret.y += isNaN(t) ? 0 : t;
-
- cs = gcs(curnode);
- if(curnode != node){
- if(d.isMoz){
- // tried left+right with differently sized left/right borders
- // it really is 2xleft border in FF, not left+right, even in RTL!
- ret.x += 2 * px(curnode,cs.borderLeftWidth);
- ret.y += 2 * px(curnode,cs.borderTopWidth);
- }else{
- ret.x += px(curnode, cs.borderLeftWidth);
- ret.y += px(curnode, cs.borderTopWidth);
- }
- }
- // static children in a static div in FF2 are affected by the div's border as well
- // but offsetParent will skip this div!
- if(d.isMoz && cs.position=="static"){
- var parent=curnode.parentNode;
- while(parent!=curnode.offsetParent){
- var pcs=gcs(parent);
- if(pcs.position=="static"){
- ret.x += px(curnode,pcs.borderLeftWidth);
- ret.y += px(curnode,pcs.borderTopWidth);
- }
- parent=parent.parentNode;
- }
- }
- curnode = curnode.offsetParent;
- }while((curnode != dh) && curnode);
- }else if(node.x && node.y){
- ret.x += isNaN(node.x) ? 0 : node.x;
- ret.y += isNaN(node.y) ? 0 : node.y;
- }
- }
- // account for document scrolling
- // if offsetParent is used, ret value already includes scroll position
- // so we may have to actually remove that value if !includeScroll
+ // account for document scrolling
if(includeScroll){
var scroll = d._docScroll();
ret.x += scroll.x;
@@ -1193,7 +1159,7 @@ if(dojo.isIE || dojo.isOpera){
}
return ret; // Object
- }
+ };
dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){
// summary:
@@ -1215,7 +1181,7 @@ if(dojo.isIE || dojo.isOpera){
mb.x = abs.x;
mb.y = abs.y;
return mb;
- }
+ };
// =============================
// Element attribute Functions
@@ -1277,7 +1243,7 @@ if(dojo.isIE || dojo.isOpera){
// given element, and false otherwise
var lc = name.toLowerCase();
return _forcePropNames[_propNames[lc] || name] || _hasAttr(byId(node), _attrNames[lc] || name); // Boolean
- }
+ };
var _evtHdlrMap = {}, _ctr = 0,
_attrId = dojo._scopeName + "attrid",
@@ -1447,7 +1413,7 @@ if(dojo.isIE || dojo.isOpera){
// node's attribute
// we need _hasAttr() here to guard against IE returning a default value
return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
- }
+ };
dojo.removeAttr = function(/*DomNode|String*/ node, /*String*/ name){
// summary:
@@ -1457,7 +1423,7 @@ if(dojo.isIE || dojo.isOpera){
// name:
// the name of the attribute to remove
byId(node).removeAttribute(_fixAttrName(name));
- }
+ };
dojo.getNodeProp = function(/*DomNode|String*/ node, /*String*/ name){
// summary:
@@ -1476,7 +1442,7 @@ if(dojo.isIE || dojo.isOpera){
// node's attribute
var attrName = _attrNames[lc] || name;
return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
- }
+ };
dojo.create = function(tag, attrs, refNode, pos){
// summary:
@@ -1491,7 +1457,7 @@ if(dojo.isIE || dojo.isOpera){
// Attributes are set by passing the optional object through `dojo.attr`.
// See `dojo.attr` for noted caveats and nuances, and API if applicable.
//|
- // Placement is done via `dojo.place`, assuming the new node to be the action
+ // Placement is done via `dojo.place`, assuming the new node to be the action
// node, passing along the optional reference node and position.
//
// tag: String|DomNode
@@ -1529,7 +1495,7 @@ if(dojo.isIE || dojo.isOpera){
// | var n = dojo.create("div", null, dojo.body());
//
// example:
- // Create an UL, and populate it with LI's. Place the list as the first-child of a
+ // Create an UL, and populate it with LI's. Place the list as the first-child of a
// node with id="someId":
// | var ul = dojo.create("ul", null, "someId", "first");
// | var items = ["one", "two", "three", "four"];
@@ -1559,7 +1525,7 @@ if(dojo.isIE || dojo.isOpera){
if(attrs){ d.attr(tag, attrs); }
if(refNode){ d.place(tag, refNode, pos); }
return tag; // DomNode
- }
+ };
/*=====
dojo.empty = function(node){
@@ -1627,11 +1593,13 @@ if(dojo.isIE || dojo.isOpera){
// generate start/end tag strings to use
// for the injection for each special tag wrap case.
for(var param in tagWrap){
- var tw = tagWrap[param];
- tw.pre = param == "option" ? '