context: dojo.widget.fillFromTemplateCache = function(	/*DomWidget*/				obj, 												/*String||dojo.uri.Uri*/	templatePath,												/*String, optional*/		templateString,												/*Boolean, optional*/		avoidCache){	// summary:	//		static method to build from a template w/ or w/o a real widget in	//		place	// obj: an instance of dojo.widget.DomWidget to initialize the template for	// templatePath: the URL to get the template from		// templateString:	//		a string to use in lieu of fetching the template from a URL	// avoidCache:	//		should the template system not use whatever is in the cache and	//		always use the passed templatePath or templateString?	// dojo.debug("avoidCache:", avoidCache);	var tpath = templatePath || obj.templatePath;	var tmplts = dojo.widget._templateCache;	if(!obj["widgetType"]) { // don't have a real template here		do {			var dummyName = "__dummyTemplate__" + dojo.widget._templateCache.dummyCount++;		} while(tmplts[dummyName]);		obj.widgetType = dummyName;	}	var wt = obj.widgetType;	var ts = tmplts[wt];	if(!ts){		tmplts[wt] = { "string": null, "node": null };		if(avoidCache){			ts = {};		}else{			ts = tmplts[wt];		}	}	if((!obj.templateString)&&(!avoidCache)){		obj.templateString = templateString || ts["string"];	}	if((!obj.templateNode)&&(!avoidCache)){		obj.templateNode = ts["node"];	}	if((!obj.templateNode)&&(!obj.templateString)&&(tpath)){		// fetch a text fragment and assign it to templateString		// NOTE: we rely on blocking IO here!		var tstring = dojo.hostenv.getText(tpath);		if(tstring){			// strip <?xml ...?> declarations so that external SVG and XML			// documents can be added to a document without worry			tstring = tstring.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, "");			var matches = tstring.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);			if(matches){				tstring = matches[1];			}		}else{			tstring = "";		}		obj.templateString = tstring;		if(!avoidCache){			tmplts[wt]["string"] = tstring;		}	}	if((!ts["string"])&&(!avoidCache)){		ts.string = obj.templateString;	}}
meta: 4707	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4707/50c3492c4c3c825dbd3401e134a19ed46799c456/DomWidget.js/clean/www/resources/dojo-ajax/src/widget/DomWidget.js