rem: splitAndFixPaths: function(/*String*/s, /*String||dojo.uri.Uri, optional*/url){ 
add: splitAndFixPaths: function(s, url){ 
context: 		splitAndFixPaths: function(/*String*/s, /*String||dojo.uri.Uri, optional*/url){			// summary:			// 		adjusts all relative paths in (hopefully) all cases, images, remote scripts, links etc.			// 		splits up content in different pieces, scripts, title, style, link and whats left becomes .xml			//	s:	The markup in string			//	url: url that pulled in markup			var titles = [], scripts = [],tmp = [];// init vars			var match = [], requires = [], attr = [], styles = [];			var str = '', path = '', fix = '', tagFix = '', tag = '', origPath = '';				if(!url) { url = "./"; } // point to this page if not set			if(s){ // make sure we dont run regexes on empty content				/************** <title> ***********/				// khtml is picky about dom faults, you can't attach a <style> or <title> node as child of body				// must go into head, so we need to cut out those tags				var regex = /<title[^>]*>([\s\S]*?)<\/title>/i;				while(match = regex.exec(s)){					titles.push(match[1]);					s = s.substring(0, match.index) + s.substr(match.index + match[0].length);				};						/************** adjust paths *****************/				if(this.adjustPaths){					// attributepaths one tag can have multiple paths example:					// <input src="..." style="url(..)"/> or <a style="url(..)" href="..">					// strip out the tag and run fix on that.					// this guarantees that we won't run replace on another tag's attribute + it was easier do					var regexFindTag = /<[a-z][a-z0-9]*[^>]*\s(?:(?:src|href|style)=[^>])+[^>]*>/i;					var regexFindAttr = /\s(src|href|style)=(['"]?)([\w()\[\]\/.,\\'"-:;#=&?\s@]+?)\2/i;					// these are the supported protocols, all other is considered relative					var regexProtocols = /^(?:[#]|(?:(?:https?|ftps?|file|javascript|mailto|news):))/;							while(tag = regexFindTag.exec(s)){						str += s.substring(0, tag.index);						s = s.substring((tag.index + tag[0].length), s.length);						tag = tag[0];									// loop through attributes						tagFix = '';						while(attr = regexFindAttr.exec(tag)){							path = ""; origPath = attr[3];							switch(attr[1].toLowerCase()){								case "src":// falltrough								case "href":									if(regexProtocols.exec(origPath)){										path = origPath;									} else {										path = (new dojo.uri.Uri(url, origPath).toString());									}									break;								case "style":// style									path = dojo.html.fixPathsInCssText(origPath, url);									break;								default:									path = origPath;							}							fix = " " + attr[1] + "=" + attr[2] + path + attr[2];							// slices up tag before next attribute check							tagFix += tag.substring(0, attr.index) + fix;							tag = tag.substring((attr.index + attr[0].length), tag.length);						}						str += tagFix + tag; //dojo.debug(tagFix + tag);					}					s = str+s;				}				/****************  cut out all <style> and <link rel="stylesheet" href=".."> **************/				regex = /(?:<(style)[^>]*>([\s\S]*?)<\/style>|<link ([^>]*rel=['"]?stylesheet['"]?[^>]*)>)/i;				while(match = regex.exec(s)){					if(match[1] && match[1].toLowerCase() == "style"){						styles.push(dojo.html.fixPathsInCssText(match[2],url));					}else if(attr = match[3].match(/href=(['"]?)([^'">]*)\1/i)){						styles.push({path: attr[2]});					}					s = s.substring(0, match.index) + s.substr(match.index + match[0].length);				};				/***************** cut out all <script> tags, push them into scripts array ***************/				var regex = /<script([^>]*)>([\s\S]*?)<\/script>/i;				var regexSrc = /src=(['"]?)([^"']*)\1/i;				var regexDojoJs = /.*(\bdojo\b\.js(?:\.uncompressed\.js)?)$/;				var regexInvalid = /(?:var )?\bdjConfig\b(?:[\s]*=[\s]*\{[^}]+\}|\.[\w]*[\s]*=[\s]*[^;\n]*)?;?|dojo\.hostenv\.writeIncludes\(\s*\);?/g;				var regexRequires = /dojo\.(?:(?:require(?:After)?(?:If)?)|(?:widget\.(?:manager\.)?registerWidgetPackage)|(?:(?:hostenv\.)?setModulePrefix|registerModulePath)|defineNamespace)\((['"]).*?\1\)\s*;?/;				while(match = regex.exec(s)){					if(this.executeScripts && match[1]){						if(attr = regexSrc.exec(match[1])){							// remove a dojo.js or dojo.js.uncompressed.js from remoteScripts							// we declare all files named dojo.js as bad, regardless of path							if(regexDojoJs.exec(attr[2])){								dojo.debug("Security note! inhibit:"+attr[2]+" from  being loaded again.");							}else{								scripts.push({path: attr[2]});							}						}					}					if(match[2]){						// remove all invalid variables etc like djConfig and dojo.hostenv.writeIncludes()						var sc = match[2].replace(regexInvalid, "");						if(!sc){ continue; }								// cut out all dojo.require (...) calls, if we have execute 						// scripts false widgets dont get there require calls						// takes out possible widgetpackage registration as well						while(tmp = regexRequires.exec(sc)){							requires.push(tmp[0]);							sc = sc.substring(0, tmp.index) + sc.substr(tmp.index + tmp[0].length);						}						if(this.executeScripts){							scripts.push(sc);						}					}					s = s.substr(0, match.index) + s.substr(match.index + match[0].length);				}				/********* extract content *********/				if(this.extractContent){					match = s.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);					if(match) { s = match[1]; }				}					/*** replace scriptScope prefix in html Event handler				* working order: find tags with scriptScope in a tag attribute				* then replace all standalone scriptScope occurencies with reference to to this widget				* valid onClick="scriptScope.func()" or onClick="scriptScope['func']();scriptScope.i++"				* not valid onClick="var.scriptScope.ref" nor onClick="var['scriptScope'].ref" */				if(this.executeScripts && this.scriptSeparation){					var regex = /(<[a-zA-Z][a-zA-Z0-9]*\s[^>]*?\S=)((['"])[^>]*scriptScope[^>]*>)/;					var regexAttr = /([\s'";:\(])scriptScope(.*)/; // we rely on that attribute begins ' or "					str = ""; 					while(tag = regex.exec(s)){						tmp = ((tag[3]=="'") ? '"': "'");fix= "";						str += s.substring(0, tag.index) + tag[1];						while(attr = regexAttr.exec(tag[2])){							tag[2] = tag[2].substring(0, attr.index) + attr[1] + "dojo.widget.byId("+ tmp + this.widgetId + tmp + ").scriptScope" + attr[2];						}						str += tag[2];						s = s.substr(tag.index + tag[0].length);					}					s = str + s;				}	 		}			return {"xml": 		s, // Object				"styles":		styles,				"titles": 		titles,				"requires": 	requires,				"scripts": 		scripts,				"url": 			url};		},
meta: 4707	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4707/50c3492c4c3c825dbd3401e134a19ed46799c456/ContentPane.js/buggy/www/resources/dojo-ajax/src/widget/ContentPane.js