[Dojo-checkins] sjmiles - r3426 - in trunk/src: . widget

dojo-checkins-admin at dojotoolkit.org dojo-checkins-admin at dojotoolkit.org
Sun Apr 2 20:02:40 MDT 2006


Author: sjmiles
Date: Sun Apr  2 20:02:39 2006
New Revision: 3426

Modified:
   trunk/src/io.js
   trunk/src/widget/Manager.js
Log:
modified dojo.io.argsFromMap so that name:[1,2,3] becomes name=1&name=2&name=3 ref. ticket #568; also trimmed trailing &
tweak (hack?) so widget manager can find ID on Opera 9

Modified: trunk/src/io.js
==============================================================================
--- trunk/src/io.js	(original)
+++ trunk/src/io.js	Sun Apr  2 20:02:39 2006
@@ -247,19 +247,25 @@
 dojo.io._bindQueue = [];
 dojo.io._queueBindInFlight = false;
 
-//FIXME: This seems to return a string with an extra & at the end. Is that the desired behavior?
-//       ScriptSrcIO.js would prefer that it is not on the end, but it is not a critical thing.
 dojo.io.argsFromMap = function(map, encoding){
-	var control = new Object();
-	var mapStr = "";
 	var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii;
-	for(var x in map){
-		if(!control[x]){
-			mapStr+= enc(x)+"="+enc(map[x])+"&";
+	var mapped = [];
+	var domap = function(elt){
+		mapped.push(enc(name)+"="+enc(elt));
+	}
+	var control = new Object();
+	for(var name in map){
+		if(!control[name]){
+			var value = map[name];
+			// FIXME: should be isArrayLike?
+			if (dojo.lang.isArray(value)){
+				dojo.lang.forEach(value, domap);
+			}else{
+				domap(value);
+			}
 		}
 	}
-
-	return mapStr;
+	return mapped.join("&");
 }
 
 dojo.io.setIFrameSrc = function(iframe, src, replace){

Modified: trunk/src/widget/Manager.js
==============================================================================
--- trunk/src/widget/Manager.js	(original)
+++ trunk/src/widget/Manager.js	Sun Apr  2 20:02:39 2006
@@ -21,6 +21,9 @@
 	this.add = function(widget){
 		dojo.profile.start("dojo.widget.manager.add");
 		this.widgets.push(widget);
+		// Opera9 uses ID (caps)
+		if (!widget.extraArgs["id"])
+			widget.extraArgs["id"] = widget.extraArgs["ID"];
 		// FIXME: the rest of this method is very slow!
 		if(widget.widgetId == ""){
 			if(widget["id"]){


More information about the Dojo-checkins mailing list