context: 	dojo._ioSetArgs = function(/*Object*/args,			/*Function*/canceller,			/*Function*/okHandler,			/*Function*/errHandler){		//	summary: 		//		sets up the Deferred and ioArgs property on the Deferred so it		//		can be used in an io call.		//	args:		//		The args object passed into the public io call. Recognized properties on		//		the args object are:		//		url:		//				String URL to server endpoint.		//		content:		//				Object containing properties with string values. These properties will be serialized as name1=value2 and passed in the request.		//		timeout:		//				Milliseconds to wait for the response. If this time passes, the then error callbacks are called.		//		form:		//				DOM node for a form. Used to extract the form values and send to the server.		//		preventCache:		//				Boolean. Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.		//		handleAs:		//				String. Acceptable values depend on the type of IO transport (see below).		//		load:		//				function(response, ioArgs){}. The load function will be called on a successful response.		//		error:		//				function(response, ioArgs){}. The error function will be called in an error case. 		//		handle		//				function(response, ioArgs){}. The handle function will be called in either the successful or error case.		//				For the load, error and handle functions, the ioArgs object will contain the following properties:		//				args:		//				the original object argument to the IO call.		//				xhr:		//						For XMLHttpRequest calls only, the XMLHttpRequest object that was used for the request.		//				url:		//						The final URL used for the call. Many times it will be different than the original args.url value.		//				query:		//						For non-GET requests, the name1=value1&name2=value2 parameters sent up in the request.		//				handleAs:		//						The final indicator on how the response will be handled.		//				id:		//						For dojo.io.script calls only, the internal script ID used for the request.		//				canDelete:		//						For dojo.io.script calls only, indicates whether the script tag that represents the request can be deleted after callbacks have been called. Used internally to know when cleanup can happen on JSONP-type requests.		//				json:		//						For dojo.io.script calls only: holds the JSON response for JSONP-type requests. Used internally to hold on to the JSON responses. You should not need to access it directly -- the same object should be passed to the success callbacks directly.		//	canceller:		//		The canceller function used for the Deferred object. The function		//		will receive one argument, the Deferred object that is related to the		//		canceller.		//	okHandler:		//		The first OK callback to be registered with Deferred. It has the opportunity		//		to transform the OK response. It will receive one argument -- the Deferred		//		object returned from this function.		//	errHandler:		//		The first error callback to be registered with Deferred. It has the opportunity		//		to do cleanup on an error. It will receive two arguments: error (the 		//		Error object) and dfd, the Deferred object returned from this function.		var ioArgs = {};		ioArgs.args = args;		//Get values from form if requestd.		var formQuery = null;		if(args.form){ 			var form = dojo.byId(args.form);			//IE requires going through getAttributeNode instead of just getAttribute in some form cases, 			//so use it for all.  See #2844			var actnNode = form.getAttributeNode("action");			ioArgs.url = args.url || (actnNode ? actnNode.value : null); 			formQuery = dojo.formToQuery(form);		}else{			ioArgs.url = args.url;		}		// set up the query params		var miArgs = [{}];			if(formQuery){			// potentially over-ride url-provided params w/ form values			miArgs.push(dojo.queryToObject(formQuery));		}		if(args.content){			// stuff in content over-rides what's set by form			miArgs.push(args.content);		}		if(args.preventCache){			miArgs.push({"dojo.preventCache": new Date().valueOf()});		}		ioArgs.query = dojo.objectToQuery(dojo.mixin.apply(null, miArgs));			// .. and the real work of getting the deferred in order, etc.		ioArgs.handleAs = args.handleAs || "text";		var d = new dojo.Deferred(canceller);		d.addCallbacks(okHandler, function(error){				return errHandler(error, d);		});		//Support specifying load, error and handle callback functions from the args.		//For those callbacks, the "this" object will be the args object.		//The callbacks will get the deferred result value as the		//first argument and the ioArgs object as the second argument.		var ld = args.load;		if(ld && dojo.isFunction(ld)){			d.addCallback(function(value){				return ld.call(args, value, ioArgs);			});		}		var err = args.error;		if(err && dojo.isFunction(err)){			d.addErrback(function(value){				return err.call(args, value, ioArgs);			});		}		var handle = args.handle;		if(handle && dojo.isFunction(handle)){			d.addBoth(function(value){				return handle.call(args, value, ioArgs);			});		}				d.ioArgs = ioArgs;			// FIXME: need to wire up the xhr object's abort method to something		// analagous in the Deferred		return d;		}
meta: 4497	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/4497/3065bd593c6619a7915841daf139ca56e5a2729a/xhr.js/clean/_base/xhr.js