You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/09/23 01:22:51 UTC

svn commit: r449122 [13/40] - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/ java/org/apache/tapestry/dojo/ java/org/apache/tapestry/dojo/form/ java/org/apache/tapestry/dojo/html/ java/org/apache/tapestry/form/ java/org/...

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_spidermonkey.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_spidermonkey.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_spidermonkey.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_spidermonkey.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,79 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+ * SpiderMonkey host environment
+ */
+
+dojo.hostenv.name_ = 'spidermonkey';
+
+dojo.hostenv.println = print;
+dojo.hostenv.exit = function(exitcode){ 
+	quit(exitcode); 
+}
+
+// version() returns 0, sigh. and build() returns nothing but just prints.
+dojo.hostenv.getVersion = function(){ return version(); }
+
+// make jsc shut up (so we can use jsc for sanity checking) 
+/*@cc_on
+@if (@_jscript_version >= 7)
+var line2pc; var print; var load; var quit;
+@end
+@*/
+
+if(typeof line2pc == 'undefined'){
+	dojo.raise("attempt to use SpiderMonkey host environment when no 'line2pc' global");
+}
+
+/*
+ * 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.
+ */
+function dj_spidermonkey_current_file(depth){
+    var s = '';
+    try{
+		throw Error("whatever");
+	}catch(e){
+		s = e.stack;
+	}
+    // lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
+    var matches = s.match(/[^@]*\.js/gi);
+    if(!matches){ 
+		dojo.raise("could not parse stack string: '" + s + "'");
+	}
+    var fname = (typeof depth != 'undefined' && depth) ? matches[depth + 1] : matches[matches.length - 1];
+    if(!fname){ 
+		dojo.raise("could not find file name in stack string '" + s + "'");
+	}
+    //print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
+    return fname;
+}
+
+// call this now because later we may not be on the top of the stack
+if(!dojo.hostenv.library_script_uri_){ 
+	dojo.hostenv.library_script_uri_ = dj_spidermonkey_current_file(0); 
+}
+
+dojo.hostenv.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. 
+	// Perhaps it is returning the value of the last thing evaluated?
+	var ok = load(uri);
+	// dojo.debug("spidermonkey load(", uri, ") returned ", ok);
+	return 1;
+}
+
+

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_spidermonkey.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,223 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+//	hostenv_svg
+if(typeof window == 'undefined'){
+	dojo.raise("attempt to use adobe svg hostenv when no window object");
+}
+dojo.debug = function(){ 
+	if (!djConfig.isDebug) { return; }
+	var args = arguments;
+	var isJUM = dj_global["jum"];
+	var s = isJUM ? "": "DEBUG: ";
+	for (var i = 0; i < args.length; ++i){ s += args[i]; }
+	if (isJUM){ // this seems to be the only way to get JUM to "play nice"
+		jum.debug(s);
+	} else{ 
+		dojo.hostenv.println(s);
+	}
+};
+
+//	set up dojo.render.
+dojo.render.name = navigator.appName;
+dojo.render.ver = parseFloat(navigator.appVersion, 10);
+switch(navigator.platform){
+	case "MacOS":
+		dojo.render.os.osx =  true;
+		break;
+	case "Linux":
+		dojo.render.os.linux =  true;
+		break;
+	case "Windows":
+		dojo.render.os.win =  true;
+		break;
+	default:
+		dojo.render.os.linux = true;
+		break;
+};
+dojo.render.svg.capable = true;
+dojo.render.svg.support.builtin = true;
+//	FIXME the following two is a big-ass hack for now.
+dojo.render.svg.moz = ((navigator.userAgent.indexOf("Gecko") >= 0) && (!((navigator.appVersion.indexOf("Konqueror") >= 0) || (navigator.appVersion.indexOf("Safari") >= 0))));
+dojo.render.svg.adobe = (window.parseXML != null);
+
+//	agent-specific implementations.
+
+//	from old hostenv_adobesvg.
+dojo.hostenv.startPackage("dojo.hostenv");
+dojo.hostenv.println = function(s){ 
+	try {
+		var ti = document.createElement("text");
+		ti.setAttribute("x","50");
+		ti.setAttribute("y", (25 + 15 * document.getElementsByTagName("text").length));
+		ti.appendChild(document.createTextNode(s));
+		document.documentElement.appendChild(ti);
+	} catch(e){ }
+};
+dojo.hostenv.name_ = "svg";
+
+//	expected/defined by bootstrap1.js
+dojo.hostenv.setModulePrefix = function(module, prefix){ };
+dojo.hostenv.getModulePrefix = function(module){ };
+dojo.hostenv.getTextStack = [];
+dojo.hostenv.loadUriStack = [];
+dojo.hostenv.loadedUris = [];
+dojo.hostenv.modules_ = {};
+dojo.hostenv.modulesLoadedFired = false;
+dojo.hostenv.modulesLoadedListeners = [];
+dojo.hostenv.getText = function(uri, cb, data){ 
+	if (!cb) var cb = function(result){ window.alert(result); };
+	if (!data) {
+		window.getUrl(uri, cb);
+	} else {
+		window.postUrl(uri, data, cb);
+	}
+};
+dojo.hostenv.getLibaryScriptUri = function(){ };
+
+dojo.hostenv.loadUri = function(uri){ };
+dojo.hostenv.loadUriAndCheck = function(uri, module){ };
+
+//	aliased in loader.js, don't ignore
+//	we are going to kill loadModule for the first round of SVG stuff, and include shit manually.
+dojo.hostenv.loadModule = function(moduleName){
+	//	just like startPackage, but this time we're just checking to make sure it exists already.
+	var a = moduleName.split(".");
+	var currentObj = window;
+	var s = [];
+	for (var i = 0; i < a.length; i++){
+		if (a[i] == "*") continue;
+		s.push(a[i]);
+		if (!currentObj[a[i]]){
+			dojo.raise("dojo.require('" + moduleName + "'): module does not exist.");
+		} else currentObj = currentObj[a[i]];
+	}
+	return; 
+};
+dojo.hostenv.startPackage = function(moduleName){
+	var a = moduleName.split(".");
+	var currentObj = window;
+	var s = [];
+	for (var i = 0; i < a.length; i++){
+		if (a[i] == "*") continue;
+		s.push(a[i]);
+		if (!currentObj[a[i]]) currentObj[a[i]] = {};
+		currentObj = currentObj[a[i]];
+	}
+	return; 
+};
+
+//	wrapper objects for ASVG
+if (window.parseXML){
+	window.XMLSerialzer = function(){
+		//	based on WebFX RichTextControl getXHTML() function.
+		function nodeToString(n, a) {
+			function fixText(s) { return String(s).replace(/\&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;"); }
+			function fixAttribute(s) { return fixText(s).replace(/\"/g, "&quot;"); }
+			switch (n.nodeType) {
+				case 1:	{	//	ELEMENT
+					var name = n.nodeName;
+					a.push("<" + name);
+					for (var i = 0; i < n.attributes.length; i++) {
+						if (n.attributes.item(i).specified) {
+							a.push(" " + n.attributes.item(i).nodeName.toLowerCase() + "=\"" + fixAttribute(n.attributes.item(i).nodeValue) + "\"");
+						}
+					}
+					if (n.canHaveChildren || n.hasChildNodes()) {
+						a.push(">");
+						for (var i = 0; i < n.childNodes.length; i++) nodeToString(n.childNodes.item(i), a);
+						a.push("</" + name + ">\n");
+					} else a.push(" />\n");
+					break;
+				}
+				case 3: {	//	TEXT
+					a.push(fixText(n.nodeValue));
+					break;
+				}
+				case 4: {	//	CDATA
+					a.push("<![CDA" + "TA[\n" + n.nodeValue + "\n]" + "]>");
+					break;
+				}
+				case 7:{	//	PROCESSING INSTRUCTION
+					a.push(n.nodeValue);
+					if (/(^<\?xml)|(^<\!DOCTYPE)/.test(n.nodeValue)) a.push("\n");
+					break;
+				}
+				case 8:{	//	COMMENT
+					a.push("<!-- " + n.nodeValue + " -->\n");
+					break;
+				}
+				case 9:		//	DOCUMENT
+				case 11:{	//	DOCUMENT FRAGMENT
+					for (var i = 0; i < n.childNodes.length; i++) nodeToString(n.childNodes.item(i), a);
+					break;
+				}
+				default:{
+					a.push("<!--\nNot Supported:\n\n" + "nodeType: " + n.nodeType + "\nnodeName: " + n.nodeName + "\n-->");
+				}
+			}
+		}
+		this.serializeToString = function(node){
+			var a = [];
+			nodeToString(node, a);
+			return a.join("");
+		};
+	};
+
+	window.DOMParser = function(){
+		//	mimetype is basically ignored
+		this.parseFromString = function(s){
+			return parseXML(s, window.document);
+		}
+	};
+
+	window.XMLHttpRequest = function(){
+		//	we ignore the setting and getting of content-type.
+		var uri = null;
+		var method = "POST";
+		var isAsync = true;	
+		var cb = function(d){
+			this.responseText = d.content;
+			try {
+				this.responseXML = parseXML(this.responseText, window.document);
+			} catch(e){}
+			this.status = "200";
+			this.statusText = "OK";
+			if (!d.success) {
+				this.status = "500";
+				this.statusText = "Internal Server Error";
+			}
+			this.onload();
+			this.onreadystatechange();
+		};
+		this.onload = function(){};
+		this.readyState = 4;
+		this.onreadystatechange = function(){};
+		this.status = 0;
+		this.statusText = "";
+		this.responseBody = null;
+		this.responseStream = null;
+		this.responseXML = null;
+		this.responseText = null;
+		this.abort = function(){ return; };
+		this.getAllResponseHeaders = function(){ return []; };
+		this.getResponseHeader = function(n){ return null; };
+		this.setRequestHeader = function(nm, val){ };
+		this.open = function(meth, url, async){ 
+			method = meth;
+			uri = url;
+		};
+		this.send = function(data){
+			var d = data || null;
+			if (method == "GET") getURL(uri, cb);
+			else postURL(uri, data, cb);
+		};
+	};
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_wsh.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_wsh.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_wsh.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_wsh.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,46 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+ * WSH
+ */
+
+dojo.hostenv.name_ = 'wsh';
+
+// make jsc shut up (so can sanity check)
+/*@cc_on
+@if (@_jscript_version >= 7)
+var WScript;
+@end
+@*/
+
+// make sure we are in right environment
+if(typeof WScript == 'undefined'){
+	dojo.raise("attempt to use WSH host environment when no WScript global");
+}
+
+dojo.hostenv.println = WScript.Echo;
+
+dojo.hostenv.getCurrentScriptUri = function(){
+	return WScript.ScriptFullName();
+}
+
+dojo.hostenv.getText = function(fpath){
+	var fso = new ActiveXObject("Scripting.FileSystemObject");
+	var istream = fso.OpenTextFile(fpath, 1); // iomode==1 means read only
+	if(!istream){
+		return null;
+	}
+	var contents = istream.ReadAll();
+	istream.Close();
+	return contents;
+}
+
+dojo.hostenv.exit = function(exitcode){ WScript.Quit(exitcode); }

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_wsh.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,14 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html");
+
+dojo.require("dojo.html.*");
+dojo.deprecated("dojo.html", "replaced by dojo.html.*", "0.5");

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/__package__.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/__package__.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/__package__.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/__package__.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,15 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.kwCompoundRequire({
+	common: [ "dojo.html.common",
+			  "dojo.html.style" ]
+});
+dojo.provide("dojo.html.*");

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/__package__.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/color.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/color.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/color.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/color.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,35 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.html.style");
+dojo.provide("dojo.html.color");
+
+dojo.require("dojo.gfx.color");
+dojo.require("dojo.lang.common");
+
+dojo.html.getBackgroundColor = function(/* HTMLElement */node){
+	//	summary
+	//	returns the background color of the passed node as a 32-bit color (RGBA)
+	node = dojo.byId(node);
+	var color;
+	do{
+		color = dojo.html.getStyle(node, "background-color");
+		// Safari doesn't say "transparent"
+		if(color.toLowerCase() == "rgba(0, 0, 0, 0)") { color = "transparent"; }
+		if(node == document.getElementsByTagName("body")[0]) { node = null; break; }
+		node = node.parentNode;
+	}while(node && dojo.lang.inArray(["transparent", ""], color));
+	if(color == "transparent"){
+		color = [255, 255, 255, 0];
+	}else{
+		color = dojo.gfx.color.extractRGB(color);
+	}
+	return color;	//	array
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/color.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/common.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/common.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/common.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/common.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,228 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.common");
+dojo.require("dojo.lang.common");
+dojo.require("dojo.dom");
+
+dojo.lang.mixin(dojo.html, dojo.dom);
+
+dojo.html.body = function(){
+	dojo.deprecated("dojo.html.body() moved to dojo.body()", "0.5");
+	return dojo.body();
+}
+
+// FIXME: we are going to assume that we can throw any and every rendering
+// engine into the IE 5.x box model. In Mozilla, we do this w/ CSS.
+// Need to investigate for KHTML and Opera
+
+dojo.html.getEventTarget = function(/* DOMEvent */evt){
+	//	summary
+	//	Returns the target of an event
+	if(!evt) { evt = dojo.global().event || {} };
+	var t = (evt.srcElement ? evt.srcElement : (evt.target ? evt.target : null));
+	while((t)&&(t.nodeType!=1)){ t = t.parentNode; }
+	return t;	//	HTMLElement
+}
+
+dojo.html.getViewport = function(){
+	//	summary
+	//	Returns the dimensions of the viewable area of a browser window
+	var _window = dojo.global();
+	var _document = dojo.doc();
+	var w = 0;
+	var h = 0;
+
+	if(dojo.render.html.mozilla){
+		// mozilla
+		w = _document.documentElement.clientWidth;
+		h = _window.innerHeight;
+	}else if(!dojo.render.html.opera && _window.innerWidth){
+		//in opera9, dojo.body().clientWidth should be used, instead
+		//of window.innerWidth/document.documentElement.clientWidth
+		//so we have to check whether it is opera
+		w = _window.innerWidth;
+		h = _window.innerHeight;
+	} else if (!dojo.render.html.opera && dojo.exists(_document, "documentElement.clientWidth")){
+		// IE6 Strict
+		var w2 = _document.documentElement.clientWidth;
+		// this lets us account for scrollbars
+		if(!w || w2 && w2 < w) {
+			w = w2;
+		}
+		h = _document.documentElement.clientHeight;
+	} else if (dojo.body().clientWidth){
+		// IE, Opera
+		w = dojo.body().clientWidth;
+		h = dojo.body().clientHeight;
+	}
+	return { width: w, height: h };	//	object
+}
+
+dojo.html.getScroll = function(){
+	//	summary
+	//	Returns the scroll position of the document
+	var _window = dojo.global();
+	var _document = dojo.doc();
+	var top = _window.pageYOffset || _document.documentElement.scrollTop || dojo.body().scrollTop || 0;
+	var left = _window.pageXOffset || _document.documentElement.scrollLeft || dojo.body().scrollLeft || 0;
+	return { 
+		top: top, 
+		left: left, 
+		offset:{ x: left, y: top }	//	note the change, NOT an Array with added properties. 
+	};	//	object
+}
+
+dojo.html.getParentByType = function(/* HTMLElement */node, /* string */type) {
+	//	summary
+	//	Returns the first ancestor of node with tagName type.
+	var _document = dojo.doc();
+	var parent = dojo.byId(node);
+	type = type.toLowerCase();
+	while((parent)&&(parent.nodeName.toLowerCase()!=type)){
+		if(parent==(_document["body"]||_document["documentElement"])){
+			return null;
+		}
+		parent = parent.parentNode;
+	}
+	return parent;	//	HTMLElement
+}
+
+dojo.html.getAttribute = function(/* HTMLElement */node, /* string */attr){
+	//	summary
+	//	Returns the value of attribute attr from node.
+	node = dojo.byId(node);
+	// FIXME: need to add support for attr-specific accessors
+	if((!node)||(!node.getAttribute)){
+		// if(attr !== 'nwType'){
+		//	alert("getAttr of '" + attr + "' with bad node"); 
+		// }
+		return null;
+	}
+	var ta = typeof attr == 'string' ? attr : new String(attr);
+
+	// first try the approach most likely to succeed
+	var v = node.getAttribute(ta.toUpperCase());
+	if((v)&&(typeof v == 'string')&&(v!="")){ 
+		return v;	//	string 
+	}
+
+	// try returning the attributes value, if we couldn't get it as a string
+	if(v && v.value){ 
+		return v.value;	//	string 
+	}
+
+	// this should work on Opera 7, but it's a little on the crashy side
+	if((node.getAttributeNode)&&(node.getAttributeNode(ta))){
+		return (node.getAttributeNode(ta)).value;	//	string
+	}else if(node.getAttribute(ta)){
+		return node.getAttribute(ta);	//	string
+	}else if(node.getAttribute(ta.toLowerCase())){
+		return node.getAttribute(ta.toLowerCase());	//	string
+	}
+	return null;	//	string
+}
+	
+dojo.html.hasAttribute = function(/* HTMLElement */node, /* string */attr){
+	//	summary
+	//	Determines whether or not the specified node carries a value for the attribute in question.
+	return dojo.html.getAttribute(dojo.byId(node), attr) ? true : false;	//	boolean
+}
+	
+dojo.html.getCursorPosition = function(/* DOMEvent */e){
+	//	summary
+	//	Returns the mouse position relative to the document (not the viewport).
+	//	For example, if you have a document that is 10000px tall,
+	//	but your browser window is only 100px tall,
+	//	if you scroll to the bottom of the document and call this function it
+	//	will return {x: 0, y: 10000}
+	e = e || dojo.global().event;
+	var cursor = {x:0, y:0};
+	if(e.pageX || e.pageY){
+		cursor.x = e.pageX;
+		cursor.y = e.pageY;
+	}else{
+		var de = dojo.doc().documentElement;
+		var db = dojo.body();
+		cursor.x = e.clientX + ((de||db)["scrollLeft"]) - ((de||db)["clientLeft"]);
+		cursor.y = e.clientY + ((de||db)["scrollTop"]) - ((de||db)["clientTop"]);
+	}
+	return cursor;	//	object
+}
+
+dojo.html.isTag = function(/* HTMLElement */node) {
+	//	summary
+	//	Like dojo.dom.isTag, except case-insensitive
+	node = dojo.byId(node);
+	if(node && node.tagName) {
+		for (var i=1; i<arguments.length; i++){
+			if (node.tagName.toLowerCase()==String(arguments[i]).toLowerCase()){
+				return String(arguments[i]).toLowerCase();	//	string
+			}
+		}
+	}
+	return "";	//	string
+}
+
+//define dojo.html.createExternalElement for IE to workaround the annoying activation "feature" in new IE
+//details: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp
+if(dojo.render.html.ie){
+	//only define createExternalElement for IE in none https to avoid "mixed content" warning dialog
+	if(window.location.href.substr(0,6).toLowerCase() != "https:"){
+		(function(){
+			// FIXME: this seems not to work correctly on IE 7!!
+
+			//The trick is to define a function in a script.src property:
+			// <script src="javascript:'function createExternalElement(){...}'"></script>,
+			//which will be treated as an external javascript file in IE
+			var xscript = dojo.doc().createElement('script');
+			xscript.src = "javascript:'dojo.html.createExternalElement=function(doc, tag){ return doc.createElement(tag); }'";
+			dojo.doc().getElementsByTagName("head")[0].appendChild(xscript);
+		})();
+	}
+}else{
+	//for other browsers, simply use document.createElement
+	//is enough
+	dojo.html.createExternalElement = function(/* HTMLDocument */doc, /* string */tag){
+		//	summary
+		//	Creates an element in the HTML document, here for ActiveX activation workaround.
+		return doc.createElement(tag);	//	HTMLElement
+	}
+}
+
+dojo.html._callDeprecated = function(inFunc, replFunc, args, argName, retValue){
+	dojo.deprecated("dojo.html." + inFunc,
+					"replaced by dojo.html." + replFunc + "(" + (argName ? "node, {"+ argName + ": " + argName + "}" : "" ) + ")" + (retValue ? "." + retValue : ""), "0.5");
+	var newArgs = [];
+	if(argName){ var argsIn = {}; argsIn[argName] = args[1]; newArgs.push(args[0]); newArgs.push(argsIn); }
+	else { newArgs = args }
+	var ret = dojo.html[replFunc].apply(dojo.html, args);
+	if(retValue){ return ret[retValue]; }
+	else { return ret; }
+}
+
+dojo.html.getViewportWidth = function(){
+	return dojo.html._callDeprecated("getViewportWidth", "getViewport", arguments, null, "width");
+}
+dojo.html.getViewportHeight = function(){
+	return dojo.html._callDeprecated("getViewportHeight", "getViewport", arguments, null, "height");
+}
+dojo.html.getViewportSize = function(){
+	return dojo.html._callDeprecated("getViewportSize", "getViewport", arguments);
+}
+dojo.html.getScrollTop = function(){
+	return dojo.html._callDeprecated("getScrollTop", "getScroll", arguments, null, "top");
+}
+dojo.html.getScrollLeft = function(){
+	return dojo.html._callDeprecated("getScrollLeft", "getScroll", arguments, null, "left");
+}
+dojo.html.getScrollOffset = function(){
+	return dojo.html._callDeprecated("getScrollOffset", "getScroll", arguments, null, "offset");
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/common.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/display.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/display.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/display.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/display.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,196 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.display");
+dojo.require("dojo.html.style");
+
+dojo.html._toggle = function(node, tester, setter){
+	node = dojo.byId(node);
+	setter(node, !tester(node));
+	return tester(node);
+}
+
+dojo.html.show = function(/* HTMLElement */node){
+	//	summary
+	//	Show the passed element
+	node = dojo.byId(node);
+	if(dojo.html.getStyleProperty(node, 'display')=='none'){
+		dojo.html.setStyle(node, 'display', (node.dojoDisplayCache||''));
+		node.dojoDisplayCache = undefined;	// cannot use delete on a node in IE6
+	}
+}
+
+dojo.html.hide = function(/* HTMLElement */node){
+	//	summary
+	//	Hide the passed element
+	node = dojo.byId(node);
+	if(typeof node["dojoDisplayCache"] == "undefined"){ // it could == '', so we cannot say !node.dojoDisplayCount
+		var d = dojo.html.getStyleProperty(node, 'display')
+		if(d!='none'){
+			node.dojoDisplayCache = d;
+		}
+	}
+	dojo.html.setStyle(node, 'display', 'none');
+}
+
+dojo.html.setShowing = function(/* HTMLElement */node, /* boolean? */showing){
+	//	summary
+	// Calls show() if showing is true, hide() otherwise
+	dojo.html[(showing ? 'show' : 'hide')](node);
+}
+
+dojo.html.isShowing = function(/* HTMLElement */node){
+	//	summary
+	//	Returns whether the element is displayed or not.
+	// FIXME: returns true if node is bad, isHidden would be easier to make correct
+	return (dojo.html.getStyleProperty(node, 'display') != 'none');	//	boolean
+}
+
+dojo.html.toggleShowing = function(/* HTMLElement */node){
+	//	summary
+	// Call setShowing() on node with the complement of isShowing(), then return the new value of isShowing()
+	return dojo.html._toggle(node, dojo.html.isShowing, dojo.html.setShowing);	//	boolean
+}
+
+// Simple mapping of tag names to display values
+// FIXME: simplistic 
+dojo.html.displayMap = { tr: '', td: '', th: '', img: 'inline', span: 'inline', input: 'inline', button: 'inline' };
+
+dojo.html.suggestDisplayByTagName = function(/* HTMLElement */node){
+	//	summary
+	// Suggest a value for the display property that will show 'node' based on it's tag
+	node = dojo.byId(node);
+	if(node && node.tagName){
+		var tag = node.tagName.toLowerCase();
+		return (tag in dojo.html.displayMap ? dojo.html.displayMap[tag] : 'block');	//	string
+	}
+}
+
+dojo.html.setDisplay = function(/* HTMLElement */node, /* string */display){
+	//	summary
+	// 	setDisplay() sets the value of style.display to value of 'display' parameter if it is a string.
+	// 	Otherwise, if 'display' is false, set style.display to 'none'.
+	// 	Finally, set 'display' to a suggested display value based on the node's tag
+	dojo.html.setStyle(node, 'display', ((display instanceof String || typeof display == "string") ? display : (display ? dojo.html.suggestDisplayByTagName(node) : 'none')));
+}
+
+dojo.html.isDisplayed = function(/* HTMLElement */node){
+	//	summary
+	// 	isDisplayed() is true if the the computed display style for node is not 'none'
+	// 	FIXME: returns true if node is bad, isNotDisplayed would be easier to make correct
+	return (dojo.html.getComputedStyle(node, 'display') != 'none');	//	boolean
+}
+
+dojo.html.toggleDisplay = function(/* HTMLElement */node){
+	//	summary
+	// 	Call setDisplay() on node with the complement of isDisplayed(), then
+	// 	return the new value of isDisplayed()
+	return dojo.html._toggle(node, dojo.html.isDisplayed, dojo.html.setDisplay);	//	boolean
+}
+
+dojo.html.setVisibility = function(/* HTMLElement */node, /* string */visibility){
+	//	summary
+	// 	setVisibility() sets the value of style.visibility to value of 'visibility' parameter if it is a string.
+	// 	Otherwise, if 'visibility' is false, set style.visibility to 'hidden'. Finally, set style.visibility to 'visible'.
+	dojo.html.setStyle(node, 'visibility', ((visibility instanceof String || typeof visibility == "string") ? visibility : (visibility ? 'visible' : 'hidden')));
+}
+
+dojo.html.isVisible = function(/* HTMLElement */node){
+	//	summary
+	// 	isVisible() is true if the the computed visibility style for node is not 'hidden'
+	// 	FIXME: returns true if node is bad, isInvisible would be easier to make correct
+	return (dojo.html.getComputedStyle(node, 'visibility') != 'hidden');	//	boolean
+}
+
+dojo.html.toggleVisibility = function(node){
+	//	summary
+	// Call setVisibility() on node with the complement of isVisible(), then return the new value of isVisible()
+	return dojo.html._toggle(node, dojo.html.isVisible, dojo.html.setVisibility);	//	boolean
+}
+
+dojo.html.setOpacity = function(/* HTMLElement */node, /* float */opacity, /* boolean? */dontFixOpacity){
+	//	summary
+	//	Sets the opacity of node in a cross-browser way.
+	//	float between 0.0 (transparent) and 1.0 (opaque)
+	node = dojo.byId(node);
+	var h = dojo.render.html;
+	if(!dontFixOpacity){
+		if( opacity >= 1.0){
+			if(h.ie){
+				dojo.html.clearOpacity(node);
+				return;
+			}else{
+				opacity = 0.999999;
+			}
+		}else if( opacity < 0.0){ opacity = 0; }
+	}
+	if(h.ie){
+		if(node.nodeName.toLowerCase() == "tr"){
+			// FIXME: is this too naive? will we get more than we want?
+			var tds = node.getElementsByTagName("td");
+			for(var x=0; x<tds.length; x++){
+				tds[x].style.filter = "Alpha(Opacity="+opacity*100+")";
+			}
+		}
+		node.style.filter = "Alpha(Opacity="+opacity*100+")";
+	}else if(h.moz){
+		node.style.opacity = opacity; // ffox 1.0 directly supports "opacity"
+		node.style.MozOpacity = opacity;
+	}else if(h.safari){
+		node.style.opacity = opacity; // 1.3 directly supports "opacity"
+		node.style.KhtmlOpacity = opacity;
+	}else{
+		node.style.opacity = opacity;
+	}
+}
+
+dojo.html.clearOpacity = function(/* HTMLElement */node){
+	//	summary
+	//	Clears any opacity setting on the passed element.
+	node = dojo.byId(node);
+	var ns = node.style;
+	var h = dojo.render.html;
+	if(h.ie){
+		try {
+			if( node.filters && node.filters.alpha ){
+				ns.filter = ""; // FIXME: may get rid of other filter effects
+			}
+		} catch(e) {
+			/*
+			 * IE7 gives error if node.filters not set;
+			 * don't know why or how to workaround (other than this)
+			 */
+		}
+	}else if(h.moz){
+		ns.opacity = 1;
+		ns.MozOpacity = 1;
+	}else if(h.safari){
+		ns.opacity = 1;
+		ns.KhtmlOpacity = 1;
+	}else{
+		ns.opacity = 1;
+	}
+}
+
+dojo.html.getOpacity = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the opacity of the passed element
+	node = dojo.byId(node);
+	var h = dojo.render.html;
+	if(h.ie){
+		var opac = (node.filters && node.filters.alpha &&
+			typeof node.filters.alpha.opacity == "number"
+			? node.filters.alpha.opacity : 100) / 100;
+	}else{
+		var opac = node.style.opacity || node.style.MozOpacity ||
+			node.style.KhtmlOpacity || 1;
+	}
+	return opac >= 0.999999 ? 1.0 : Number(opac);	//	float
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/display.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/iframe.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/iframe.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/iframe.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/iframe.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,117 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.iframe");
+dojo.require("dojo.html.util");
+
+// thanks burstlib!
+dojo.html.iframeContentWindow = function(/* HTMLIFrameElement */iframe_el) {
+	//	summary
+	//	returns the window reference of the passed iframe
+	var win = dojo.html.getDocumentWindow(dojo.html.iframeContentDocument(iframe_el)) ||
+		// Moz. TODO: is this available when defaultView isn't?
+		dojo.html.iframeContentDocument(iframe_el).__parent__ ||
+		(iframe_el.name && document.frames[iframe_el.name]) || null;
+	return win;	//	Window
+}
+
+dojo.html.iframeContentDocument = function(/* HTMLIFrameElement */iframe_el){
+	//	summary
+	//	returns a reference to the document object inside iframe_el
+	var doc = iframe_el.contentDocument // W3
+		|| ((iframe_el.contentWindow)&&(iframe_el.contentWindow.document))	// IE
+		|| ((iframe_el.name)&&(document.frames[iframe_el.name])&&(document.frames[iframe_el.name].document)) 
+		|| null;
+	return doc;	//	HTMLDocument
+}
+
+dojo.html.BackgroundIframe = function(/* HTMLElement */node) {
+	//	summary
+	//	For IE z-index schenanigans
+	//	Two possible uses:
+	//	1. new dojo.html.BackgroundIframe(node)
+	//		Makes a background iframe as a child of node, that fills area (and position) of node
+	//	2. new dojo.html.BackgroundIframe()
+	//		Attaches frame to dojo.body().  User must call size() to set size.
+	if(dojo.render.html.ie55 || dojo.render.html.ie60) {
+		var html="<iframe "
+			+ "style='position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"
+			+ "z-index: -1; filter:Alpha(Opacity=\"0\");' "
+			+ ">";
+		this.iframe = dojo.doc().createElement(html);
+		this.iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didnt work.
+		if(node){
+			node.appendChild(this.iframe);
+			this.domNode=node;
+		}else{
+			dojo.body().appendChild(this.iframe);
+			this.iframe.style.display="none";
+		}
+	}
+}
+dojo.lang.extend(dojo.html.BackgroundIframe, {
+	iframe: null,
+	onResized: function(){
+		//	summary
+		//	Resize event handler.
+		// TODO: this function shouldn't be necessary but setting width=height=100% doesn't work!
+		if(this.iframe && this.domNode && this.domNode.parentNode){ // No parentElement if onResized() timeout event occurs on a removed domnode
+			var outer = dojo.html.getMarginBox(this.domNode);
+			if (outer.width  == 0 || outer.height == 0 ){
+				dojo.lang.setTimeout(this, this.onResized, 100);
+				return;
+			}
+			this.iframe.style.width = outer.width + "px";
+			this.iframe.style.height = outer.height + "px";
+		}
+	},
+
+	size: function(/* HTMLElement */node) {
+		// 	Call this function if the iframe is connected to dojo.body() rather than the node being shadowed 
+		//	(TODO: erase)
+		if(!this.iframe) { return; }
+		var coords = dojo.html.toCoordinateObject(node, true, dojo.html.boxSizing.BORDER_BOX);
+		this.iframe.style.width = coords.width + "px";
+		this.iframe.style.height = coords.height + "px";
+		this.iframe.style.left = coords.left + "px";
+		this.iframe.style.top = coords.top + "px";
+	},
+
+	setZIndex: function(/* HTMLElement */node) {
+		//	summary
+		//	Sets the z-index of the background iframe.
+		if(!this.iframe) { return; }
+		if(dojo.dom.isNode(node)) {
+			this.iframe.style.zIndex = dojo.html.getStyle(node, "z-index") - 1;
+		} else if(!isNaN(node)) {
+			this.iframe.style.zIndex = node;
+		}
+	},
+
+	show: function() {
+		//	summary
+		//	show the iframe
+		if(!this.iframe) { return; }
+		this.iframe.style.display = "block";
+	},
+
+	hide: function() {
+		//	summary
+		//	hide the iframe
+		if(!this.iframe) { return; }
+		this.iframe.style.display = "none";
+	},
+
+	remove: function() {
+		//	summary
+		//	remove the iframe
+		dojo.html.removeNode(this.iframe);
+	}
+});

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/iframe.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowB.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowB.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowB.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowBL.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowBL.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowBL.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowBR.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowBR.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowBR.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowL.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowL.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowL.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowR.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowR.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowR.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowT.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowT.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowT.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTL.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTL.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTL.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTR..png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTR..png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTR..png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTR.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTR.png?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/images/shadowTR.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/layout.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/layout.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/layout.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/layout.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,487 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.layout");
+
+dojo.require("dojo.html.common");
+dojo.require("dojo.html.style");
+dojo.require("dojo.html.display");
+
+dojo.html.sumAncestorProperties = function(/* HTMLElement */node, /* string */prop){
+	//	summary
+	//	Returns the sum of the passed property on all ancestors of node.
+	node = dojo.byId(node);
+	if(!node){ return 0; } // FIXME: throw an error?
+	
+	var retVal = 0;
+	while(node){
+		if(dojo.html.getComputedStyle(node, 'position') == 'fixed'){
+			return 0;
+		}
+		var val = node[prop];
+		if(val){
+			retVal += val - 0;
+			if(node==dojo.body()){ break; }// opera and khtml #body & #html has the same values, we only need one value
+		}
+		node = node.parentNode;
+	}
+	return retVal;	//	integer
+}
+
+dojo.html.setStyleAttributes = function(/* HTMLElement */node, /* string */attributes) { 
+	//	summary
+	//	allows a dev to pass a string similar to what you'd pass in style="", and apply it to a node.
+	node = dojo.byId(node);
+	var splittedAttribs=attributes.replace(/(;)?\s*$/, "").split(";"); 
+	for(var i=0; i<splittedAttribs.length; i++){ 
+		var nameValue=splittedAttribs[i].split(":"); 
+		var name=nameValue[0].replace(/\s*$/, "").replace(/^\s*/, "").toLowerCase();
+		var value=nameValue[1].replace(/\s*$/, "").replace(/^\s*/, "");
+		switch(name){
+			case "opacity":
+				dojo.html.setOpacity(node, value); 
+				break; 
+			case "content-height":
+				dojo.html.setContentBox(node, {height: value}); 
+				break; 
+			case "content-width":
+				dojo.html.setContentBox(node, {width: value}); 
+				break; 
+			case "outer-height":
+				dojo.html.setMarginBox(node, {height: value}); 
+				break; 
+			case "outer-width":
+				dojo.html.setMarginBox(node, {width: value}); 
+				break; 
+			default:
+				node.style[dojo.html.toCamelCase(name)]=value; 
+		}
+	} 
+}
+
+dojo.html.boxSizing = {
+	MARGIN_BOX: "margin-box",
+	BORDER_BOX: "border-box",
+	PADDING_BOX: "padding-box",
+	CONTENT_BOX: "content-box"
+};
+
+dojo.html.getAbsolutePosition = dojo.html.abs = function(/* HTMLElement */node, /* boolean? */includeScroll, /* string? */boxType){
+	//	summary
+	//	Gets the absolute position of the passed element based on the document itself.
+	node = dojo.byId(node, node.ownerDocument);
+	var ret = {
+		x: 0,
+		y: 0
+	};
+
+	var bs = dojo.html.boxSizing;
+	if(!boxType) { boxType = bs.CONTENT_BOX; }
+	var nativeBoxType = 2; //BORDER box
+	var targetBoxType;
+	switch(boxType){
+		case bs.MARGIN_BOX:
+			targetBoxType = 3;
+			break;
+		case bs.BORDER_BOX:
+			targetBoxType = 2;
+			break;
+		case bs.PADDING_BOX:
+		default:
+			targetBoxType = 1;
+			break;
+		case bs.CONTENT_BOX:
+			targetBoxType = 0;
+			break;
+	}
+
+	var h = dojo.render.html;
+	var db = document["body"]||document["documentElement"];
+
+	if(h.ie){
+		with(node.getBoundingClientRect()){
+			ret.x = left-2;
+			ret.y = top-2;
+		}
+	}else if(document.getBoxObjectFor){
+		// mozilla
+		nativeBoxType = 1; //getBoxObjectFor return padding box coordinate
+		try{
+			var bo = document.getBoxObjectFor(node);
+			ret.x = bo.x - dojo.html.sumAncestorProperties(node, "scrollLeft");
+			ret.y = bo.y - dojo.html.sumAncestorProperties(node, "scrollTop");
+		}catch(e){
+			// squelch
+		}
+	}else{
+		if(node["offsetParent"]){
+			var endNode;
+			// in Safari, if the node is an absolutely positioned child of
+			// the body and the body has a margin the offset of the child
+			// and the body contain the body's margins, so we need to end
+			// at the body
+			if(	(h.safari)&&
+				(node.style.getPropertyValue("position") == "absolute")&&
+				(node.parentNode == db)){
+				endNode = db;
+			}else{
+				endNode = db.parentNode;
+			}
+
+			//TODO: set correct nativeBoxType for safari/konqueror
+
+			if(node.parentNode != db){
+				var nd = node;
+				if(dojo.render.html.opera){ nd = db; }
+				ret.x -= dojo.html.sumAncestorProperties(nd, "scrollLeft");
+				ret.y -= dojo.html.sumAncestorProperties(nd, "scrollTop");
+			}
+			var curnode = node;
+			do{
+				var n = curnode["offsetLeft"];
+				//FIXME: ugly hack to workaround the submenu in 
+				//popupmenu2 does not shown up correctly in opera. 
+				//Someone have a better workaround?
+				if(!h.opera || n>0){
+					ret.x += isNaN(n) ? 0 : n;
+				}
+				var m = curnode["offsetTop"];
+				ret.y += isNaN(m) ? 0 : m;
+				curnode = curnode.offsetParent;
+			}while((curnode != endNode)&&(curnode != null));
+		}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(includeScroll){
+		var scroll = dojo.html.getScroll();
+		ret.y += scroll.top;
+		ret.x += scroll.left;
+	}
+
+	var extentFuncArray=[dojo.html.getPaddingExtent, dojo.html.getBorderExtent, dojo.html.getMarginExtent];
+	if(nativeBoxType > targetBoxType){
+		for(var i=targetBoxType;i<nativeBoxType;++i){
+			ret.y += extentFuncArray[i](node, 'top');
+			ret.x += extentFuncArray[i](node, 'left');
+		}
+	}else if(nativeBoxType < targetBoxType){
+		for(var i=targetBoxType;i>nativeBoxType;--i){
+			ret.y -= extentFuncArray[i-1](node, 'top');
+			ret.x -= extentFuncArray[i-1](node, 'left');
+		}
+	}
+	ret.top = ret.y;
+	ret.left = ret.x;
+	return ret;	//	object
+}
+
+dojo.html.isPositionAbsolute = function(/* HTMLElement */node){
+	//	summary
+	//	Returns if the element is absolutely positioned or not.
+	return (dojo.html.getComputedStyle(node, 'position') == 'absolute');	//	boolean
+}
+
+dojo.html._sumPixelValues = function(/* HTMLElement */node, selectors, autoIsZero){
+	var total = 0;
+	for(var x=0; x<selectors.length; x++){
+		total += dojo.html.getPixelValue(node, selectors[x], autoIsZero);
+	}
+	return total;
+}
+
+dojo.html.getMargin = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the dimensions of the passed node including margins.
+	return {
+		width: dojo.html._sumPixelValues(node, ["margin-left", "margin-right"], (dojo.html.getComputedStyle(node, 'position') == 'absolute')),
+		height: dojo.html._sumPixelValues(node, ["margin-top", "margin-bottom"], (dojo.html.getComputedStyle(node, 'position') == 'absolute'))
+	};	//	object
+}
+
+dojo.html.getBorder = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the dimensions of the passed node including borders.
+	return {
+		width: dojo.html.getBorderExtent(node, 'left') + dojo.html.getBorderExtent(node, 'right'),
+		height: dojo.html.getBorderExtent(node, 'top') + dojo.html.getBorderExtent(node, 'bottom')
+	};	//	object
+}
+
+dojo.html.getBorderExtent = function(/* HTMLElement */node, /* string */side){
+	//	summary
+	//	returns the width of the requested border
+	return (dojo.html.getStyle(node, 'border-' + side + '-style') == 'none' ? 0 : dojo.html.getPixelValue(node, 'border-' + side + '-width'));	// integer
+}
+
+dojo.html.getMarginExtent = function(/* HTMLElement */node, /* string */side){
+	//	summary
+	//	returns the width of the requested margin
+	return dojo.html._sumPixelValues(node, ["margin-" + side], dojo.html.isPositionAbsolute(node));	//	integer
+}
+
+dojo.html.getPaddingExtent = function(/* HTMLElement */node, /* string */side){
+	//	summary
+	//	Returns the width of the requested padding 
+	return dojo.html._sumPixelValues(node, ["padding-" + side], true);	//	integer
+}
+
+dojo.html.getPadding = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the dimensions of the passed node including padding.
+	return {
+		width: dojo.html._sumPixelValues(node, ["padding-left", "padding-right"], true),
+		height: dojo.html._sumPixelValues(node, ["padding-top", "padding-bottom"], true)
+	};	//	object
+}
+
+dojo.html.getPadBorder = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the dimesions of the passed node including padding and border
+	var pad = dojo.html.getPadding(node);
+	var border = dojo.html.getBorder(node);
+	return { width: pad.width + border.width, height: pad.height + border.height };	//	object
+}
+
+dojo.html.getBoxSizing = function(/* HTMLElement */node){
+	//	summary
+	//	Returns which box model the passed element is working with
+	var h = dojo.render.html;
+	var bs = dojo.html.boxSizing;
+	if((h.ie)||(h.opera)){ 
+		var cm = document["compatMode"];
+		if((cm == "BackCompat")||(cm == "QuirksMode")){ 
+			return bs.BORDER_BOX; 	//	string
+		}else{
+			return bs.CONTENT_BOX; 	//	string
+		}
+	}else{
+		if(arguments.length == 0){ node = document.documentElement; }
+		var sizing = dojo.html.getStyle(node, "-moz-box-sizing");
+		if(!sizing){ sizing = dojo.html.getStyle(node, "box-sizing"); }
+		return (sizing ? sizing : bs.CONTENT_BOX);	//	string
+	}
+}
+
+dojo.html.isBorderBox = function(/* HTMLElement */node){
+	//	summary
+	//	returns whether the passed element is using border box sizing or not.
+	return (dojo.html.getBoxSizing(node) == dojo.html.boxSizing.BORDER_BOX);	//	boolean
+}
+
+dojo.html.getBorderBox = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the dimensions of the passed element based on border-box sizing.
+	node = dojo.byId(node);
+	return { width: node.offsetWidth, height: node.offsetHeight };	//	object
+}
+
+dojo.html.getPaddingBox = function(/* HTMLElement */node){
+	//	summary
+	//	Returns the dimensions of the passed node, with border calcs removed.
+	var box = dojo.html.getBorderBox(node);
+	var border = dojo.html.getBorder(node);
+	return {
+		width: box.width - border.width,
+		height:box.height - border.height
+	};	//	object
+}
+
+dojo.html.getContentBox = function(/* HTMLElement */node){
+	//	summary
+	//	returns the dimensions of the passed node without any padding, border or margin calcs.
+	node = dojo.byId(node);
+	var padborder = dojo.html.getPadBorder(node);
+	return {
+		width: node.offsetWidth - padborder.width,
+		height: node.offsetHeight - padborder.height
+	};	//	object
+}
+
+dojo.html.setContentBox = function(/* HTMLElement */node, /* object */args){
+	//	summary
+	//	Sets the dimensions of the passed node according to content sizing.
+	node = dojo.byId(node);
+	var width = 0; var height = 0;
+	var isbb = dojo.html.isBorderBox(node);
+	var padborder = (isbb ? dojo.html.getPadBorder(node) : { width: 0, height: 0});
+	var ret = {};
+	if(typeof args.width != "undefined"){
+		width = args.width + padborder.width;
+		ret.width = dojo.html.setPositivePixelValue(node, "width", width);
+	}
+	if(typeof args.height != "undefined"){
+		height = args.height + padborder.height;
+		ret.height = dojo.html.setPositivePixelValue(node, "height", height);
+	}
+	return ret;	//	object
+}
+
+dojo.html.getMarginBox = function(/* HTMLElement */node){
+	//	summary
+	//	returns the dimensions of the passed node including any margins.
+	var borderbox = dojo.html.getBorderBox(node);
+	var margin = dojo.html.getMargin(node);
+	return { width: borderbox.width + margin.width, height: borderbox.height + margin.height };	//	object
+}
+
+dojo.html.setMarginBox = function(/* HTMLElement */node, /* object */args){
+	//	summary
+	//	Sets the dimensions of the passed node using margin box calcs.
+	node = dojo.byId(node);
+	var width = 0; var height = 0;
+	var isbb = dojo.html.isBorderBox(node);
+	var padborder = (!isbb ? dojo.html.getPadBorder(node) : { width: 0, height: 0 });
+	var margin = dojo.html.getMargin(node);
+	var ret = {};
+	if(typeof args.width != "undefined"){
+		width = args.width - padborder.width;
+		width -= margin.width;
+		ret.width = dojo.html.setPositivePixelValue(node, "width", width);
+	}
+	if(typeof args.height != "undefined"){
+		height = args.height - padborder.height;
+		height -= margin.height;
+		ret.height = dojo.html.setPositivePixelValue(node, "height", height);
+	}
+	return ret;	//	object
+}
+
+dojo.html.getElementBox = function(/* HTMLElement */node, /* string */type){
+	//	summary
+	//	return dimesions of a node based on the passed box model type.
+	var bs = dojo.html.boxSizing;
+	switch(type){
+		case bs.MARGIN_BOX:
+			return dojo.html.getMarginBox(node);	//	object
+		case bs.BORDER_BOX:
+			return dojo.html.getBorderBox(node);	//	object
+		case bs.PADDING_BOX:
+			return dojo.html.getPaddingBox(node);	//	object
+		case bs.CONTENT_BOX:
+		default:
+			return dojo.html.getContentBox(node);	//	object
+	}
+}
+// in: coordinate array [x,y,w,h] or dom node
+// return: coordinate object
+dojo.html.toCoordinateObject = dojo.html.toCoordinateArray = function(/* array */coords, /* boolean? */includeScroll, /* string? */boxtype) {
+	//	summary
+	//	Converts an array of coordinates into an object of named arguments.
+	if(coords instanceof Array || typeof coords == "array"){
+		dojo.deprecated("dojo.html.toCoordinateArray", "use dojo.html.toCoordinateObject({left: , top: , width: , height: }) instead", "0.5");
+		// coords is already an array (of format [x,y,w,h]), just return it
+		while ( coords.length < 4 ) { coords.push(0); }
+		while ( coords.length > 4 ) { coords.pop(); }
+		var ret = {
+			left: coords[0],
+			top: coords[1],
+			width: coords[2],
+			height: coords[3]
+		};
+	}else if(!coords.nodeType && !(coords instanceof String || typeof coords == "string") &&
+			 ('width' in coords || 'height' in coords || 'left' in coords ||
+			  'x' in coords || 'top' in coords || 'y' in coords)){
+		// coords is a coordinate object or at least part of one
+		var ret = {
+			left: coords.left||coords.x||0,
+			top: coords.top||coords.y||0,
+			width: coords.width||0,
+			height: coords.height||0
+		};
+	}else{
+		// coords is an dom object (or dom object id); return it's coordinates
+		var node = dojo.byId(coords);
+		var pos = dojo.html.abs(node, includeScroll, boxtype);
+		var marginbox = dojo.html.getMarginBox(node);
+		var ret = {
+			left: pos.left,
+			top: pos.top,
+			width: marginbox.width,
+			height: marginbox.height
+		};
+	}
+	ret.x = ret.left;
+	ret.y = ret.top;
+	return ret;	//	object
+}
+
+dojo.html.setMarginBoxWidth = dojo.html.setOuterWidth = function(node, width){
+	return dojo.html._callDeprecated("setMarginBoxWidth", "setMarginBox", arguments, "width");
+}
+dojo.html.setMarginBoxHeight = dojo.html.setOuterHeight = function(){
+	return dojo.html._callDeprecated("setMarginBoxHeight", "setMarginBox", arguments, "height");
+}
+dojo.html.getMarginBoxWidth = dojo.html.getOuterWidth = function(){
+	return dojo.html._callDeprecated("getMarginBoxWidth", "getMarginBox", arguments, null, "width");
+}
+dojo.html.getMarginBoxHeight = dojo.html.getOuterHeight = function(){
+	return dojo.html._callDeprecated("getMarginBoxHeight", "getMarginBox", arguments, null, "height");
+}
+dojo.html.getTotalOffset = function(node, type, includeScroll){
+	return dojo.html._callDeprecated("getTotalOffset", "getAbsolutePosition", arguments, null, type);
+}
+dojo.html.getAbsoluteX = function(node, includeScroll){
+	return dojo.html._callDeprecated("getAbsoluteX", "getAbsolutePosition", arguments, null, "x");
+}
+dojo.html.getAbsoluteY = function(node, includeScroll){
+	return dojo.html._callDeprecated("getAbsoluteY", "getAbsolutePosition", arguments, null, "y");
+}
+dojo.html.totalOffsetLeft = function(node, includeScroll){
+	return dojo.html._callDeprecated("totalOffsetLeft", "getAbsolutePosition", arguments, null, "left");
+}
+dojo.html.totalOffsetTop = function(node, includeScroll){
+	return dojo.html._callDeprecated("totalOffsetTop", "getAbsolutePosition", arguments, null, "top");
+}
+dojo.html.getMarginWidth = function(node){
+	return dojo.html._callDeprecated("getMarginWidth", "getMargin", arguments, null, "width");
+}
+dojo.html.getMarginHeight = function(node){
+	return dojo.html._callDeprecated("getMarginHeight", "getMargin", arguments, null, "height");
+}
+dojo.html.getBorderWidth = function(node){
+	return dojo.html._callDeprecated("getBorderWidth", "getBorder", arguments, null, "width");
+}
+dojo.html.getBorderHeight = function(node){
+	return dojo.html._callDeprecated("getBorderHeight", "getBorder", arguments, null, "height");
+}
+dojo.html.getPaddingWidth = function(node){
+	return dojo.html._callDeprecated("getPaddingWidth", "getPadding", arguments, null, "width");
+}
+dojo.html.getPaddingHeight = function(node){
+	return dojo.html._callDeprecated("getPaddingHeight", "getPadding", arguments, null, "height");
+}
+dojo.html.getPadBorderWidth = function(node){
+	return dojo.html._callDeprecated("getPadBorderWidth", "getPadBorder", arguments, null, "width");
+}
+dojo.html.getPadBorderHeight = function(node){
+	return dojo.html._callDeprecated("getPadBorderHeight", "getPadBorder", arguments, null, "height");
+}
+dojo.html.getBorderBoxWidth = dojo.html.getInnerWidth = function(){
+	return dojo.html._callDeprecated("getBorderBoxWidth", "getBorderBox", arguments, null, "width");
+}
+dojo.html.getBorderBoxHeight = dojo.html.getInnerHeight = function(){
+	return dojo.html._callDeprecated("getBorderBoxHeight", "getBorderBox", arguments, null, "height");
+}
+dojo.html.getContentBoxWidth = dojo.html.getContentWidth = function(){
+	return dojo.html._callDeprecated("getContentBoxWidth", "getContentBox", arguments, null, "width");
+}
+dojo.html.getContentBoxHeight = dojo.html.getContentHeight = function(){
+	return dojo.html._callDeprecated("getContentBoxHeight", "getContentBox", arguments, null, "height");
+}
+dojo.html.setContentBoxWidth = dojo.html.setContentWidth = function(node, width){
+	return dojo.html._callDeprecated("setContentBoxWidth", "setContentBox", arguments, "width");
+}
+dojo.html.setContentBoxHeight = dojo.html.setContentHeight = function(node, height){
+	return dojo.html._callDeprecated("setContentBoxHeight", "setContentBox", arguments, "height");
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/layout.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/selection.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/selection.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/selection.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/selection.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,376 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.html.common");
+dojo.provide("dojo.html.selection");
+
+dojo.require("dojo.dom");
+dojo.require("dojo.lang.common");
+
+/**
+ * type of selection
+**/
+dojo.html.selectionType = {
+	NONE : 0, //selection is empty
+	TEXT : 1, //selection contains text (may also contains CONTROL objects)
+	CONTROL : 2 //only one element is selected (such as img, table etc)
+};
+
+dojo.html.clearSelection = function(){
+	// summary: deselect the current selection to make it empty
+	var _window = dojo.global();
+	var _document = dojo.doc();
+	try{
+		if(_window["getSelection"]){ 
+			if(dojo.render.html.safari){
+				// pulled from WebCore/ecma/kjs_window.cpp, line 2536
+				_window.getSelection().collapse();
+			}else{
+				_window.getSelection().removeAllRanges();
+			}
+		}else if(_document.selection){
+			if(_document.selection.empty){
+				_document.selection.empty();
+			}else if(_document.selection.clear){
+				_document.selection.clear();
+			}
+		}
+		return true;
+	}catch(e){
+		dojo.debug(e);
+		return false;
+	}
+}
+
+dojo.html.disableSelection = function(/*DomNode*/element){
+	// summary: disable selection on a node
+	element = dojo.byId(element)||dojo.body();
+	var h = dojo.render.html;
+	
+	if(h.mozilla){
+		element.style.MozUserSelect = "none";
+	}else if(h.safari){
+		element.style.KhtmlUserSelect = "none"; 
+	}else if(h.ie){
+		element.unselectable = "on";
+	}else{
+		return false;
+	}
+	return true;
+}
+
+dojo.html.enableSelection = function(/*DomNode*/element){
+	// summary: enable selection on a node
+	element = dojo.byId(element)||dojo.body();
+	
+	var h = dojo.render.html;
+	if(h.mozilla){ 
+		element.style.MozUserSelect = ""; 
+	}else if(h.safari){
+		element.style.KhtmlUserSelect = "";
+	}else if(h.ie){
+		element.unselectable = "off";
+	}else{
+		return false;
+	}
+	return true;
+}
+
+dojo.html.selectElement = function(/*DomNode*/element){
+	dojo.deprecated("dojo.html.selectElement", "replaced by dojo.html.selection.selectElementChildren", 0.5);
+}
+
+dojo.html.selectInputText = function(/*DomNode*/element){
+	// summary: select all the text in an input element
+	var _window = dojo.global();
+	var _document = dojo.doc();
+	element = dojo.byId(element);
+	if(_document["selection"] && dojo.body()["createTextRange"]){ // IE
+		var range = element.createTextRange();
+		range.moveStart("character", 0);
+		range.moveEnd("character", element.value.length);
+		range.select();
+	}else if(_window["getSelection"]){
+		var selection = _window.getSelection();
+		// FIXME: does this work on Safari?
+		element.setSelectionRange(0, element.value.length);
+	}
+	element.focus();
+}
+
+
+dojo.html.isSelectionCollapsed = function(){
+	dojo.deprecated("dojo.html.isSelectionCollapsed", "replaced by dojo.html.selection.isCollapsed", 0.5);
+	return dojo.html.selection.isCollapsed();
+}
+
+dojo.lang.mixin(dojo.html.selection, {
+	getType: function() {
+		// summary: Get the selection type (like document.select.type in IE).
+		if(dojo.doc()["selection"]){ //IE
+			return dojo.html.selectionType[dojo.doc().selection.type.toUpperCase()];
+		}else{
+			var stype = dojo.html.selectionType.TEXT;
+	
+			// Check if the actual selection is a CONTROL (IMG, TABLE, HR, etc...).
+			var oSel;
+			try {oSel = dojo.global().getSelection();}
+			catch (e) {}
+			
+			if(oSel && oSel.rangeCount==1){
+				var oRange = oSel.getRangeAt(0);
+				if (oRange.startContainer == oRange.endContainer && (oRange.endOffset - oRange.startOffset) == 1
+					&& oRange.startContainer.nodeType != dojo.dom.TEXT_NODE) {
+					stype = dojo.html.selectionType.CONTROL;
+				}
+			}
+			return stype;
+		}
+	},
+	isCollapsed: function() {
+		// summary: return whether the current selection is empty
+		var _window = dojo.global();
+		var _document = dojo.doc();
+		if(_document["selection"]){ // IE
+			return _document.selection.createRange().text == "";
+		}else if(_window["getSelection"]){
+			var selection = _window.getSelection();
+			if(dojo.lang.isString(selection)){ // Safari
+				return selection == "";
+			}else{ // Mozilla/W3
+				return selection.isCollapsed || selection.toString() == "";
+			}
+		}
+	},
+	getSelectedElement: function() {
+		// summary: 
+		//		Retrieves the selected element (if any), just in the case that a single
+		//		element (object like and image or a table) is selected.
+		if ( dojo.html.selection.getType() == dojo.html.selectionType.CONTROL ){
+			if(dojo.doc()["selection"]){ //IE
+				var range = dojo.doc().selection.createRange();
+		
+				if ( range && range.item ){
+					return dojo.doc().selection.createRange().item(0);
+				}
+			}else{
+				var selection = dojo.global().getSelection();
+				return selection.anchorNode.childNodes[ selection.anchorOffset ];
+			}
+		}
+	},
+	getParentElement: function() {
+		// summary: 
+		//		Get the parent element of the current selection
+		if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){
+			var p = dojo.html.selection.getSelectedElement();
+			if(p){ return p.parentNode; }
+		}else{
+			if(dojo.doc()["selection"]){ //IE
+				return dojo.doc().selection.createRange().parentElement();
+			}else{
+				var selection = dojo.global().getSelection();
+				if(selection){
+					var node = selection.anchorNode;
+		
+					while ( node && node.nodeType != dojo.dom.ELEMENT_NODE ){
+						node = node.parentNode;
+					}
+		
+					return node;
+				}
+			}
+		}
+	},
+	getSelectedText: function(){
+		// summary:
+		//		Return the text (no html tags) included in the current selection or null if no text is selected
+		if(dojo.doc()["selection"]){ //IE
+			if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){
+				return null;
+			}
+			return dojo.doc().selection.createRange().text;
+		}else{
+			var selection = dojo.global().getSelection();
+			if(selection){
+				return selection.toString();
+			}
+		}
+	},
+	getSelectedHtml: function(){
+		// summary:
+		//		Return the html of the current selection or null if unavailable
+		if(dojo.doc()["selection"]){ //IE
+			if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){
+				return null;
+			}
+			return dojo.doc().selection.createRange().htmlText;
+		}else{
+			var selection = dojo.global().getSelection();
+			if(selection && selection.rangeCount){
+				var frag = selection.getRangeAt(0).cloneContents();
+				var div = document.createElement("div");
+				div.appendChild(frag);
+				return div.innerHTML;
+			}
+			return null;
+		}
+	},
+	hasAncestorElement: function(/*String*/tagName /* ... */){
+		// summary: 
+		// 		Check whether current selection has a  parent element which is of type tagName (or one of the other specified tagName)
+		return (dojo.html.selection.getAncestorElement.apply(this, arguments) != null);
+	},
+	getAncestorElement: function(/*String*/tagName /* ... */){
+		// summary:
+		//		Return the parent element of the current selection which is of type tagName (or one of the other specified tagName)
+		var node = dojo.html.selection.getSelectedElement() || dojo.html.selection.getParentElement();
+		while(node /*&& node.tagName.toLowerCase() != 'body'*/){
+			if(dojo.html.selection.isTag(node, arguments).length>0){
+				return node;
+			}
+			node = node.parentNode;
+		}
+		return null;
+	},
+	//modified from dojo.html.isTag to take an array as second parameter
+	isTag: function(/*DomNode*/node, /*Array*/tags) {
+		if(node && node.tagName) {
+			for (var i=0; i<tags.length; i++){
+				if (node.tagName.toLowerCase()==String(tags[i]).toLowerCase()){
+					return String(tags[i]).toLowerCase();
+				}
+			}
+		}
+		return "";
+	},
+	selectElement: function(/*DomNode*/element) {
+		// summary: clear previous selection and select element (including all its children)
+		var _window = dojo.global();
+		var _document = dojo.doc();
+		element = dojo.byId(element);
+		if(_document.selection && dojo.body().createTextRange){ // IE
+			try{
+				var range = dojo.body().createControlRange();
+				range.addElement(element);
+				range.select();
+			}catch(e){
+				dojo.html.selection.selectElementChildren(element);
+			}
+		}else if(_window["getSelection"]){
+			var selection = _window.getSelection();
+			// FIXME: does this work on Safari?
+			if(selection["removeAllRanges"]){ // Mozilla
+				var range = _document.createRange() ;
+				range.selectNode(element) ;
+				selection.removeAllRanges() ;
+				selection.addRange(range) ;
+			}
+		}
+	},
+	selectElementChildren: function(/*DomNode*/element){
+		// summary: clear previous selection and select the content of the node (excluding the node itself)
+		var _window = dojo.global();
+		var _document = dojo.doc();
+		element = dojo.byId(element);
+		if(_document.selection && dojo.body().createTextRange){ // IE
+			var range = dojo.body().createTextRange();
+			range.moveToElementText(element);
+			range.select();
+		}else if(_window["getSelection"]){
+			var selection = _window.getSelection();
+			if(selection["setBaseAndExtent"]){ // Safari
+				selection.setBaseAndExtent(element, 0, element, element.innerText.length - 1);
+			} else if(selection["selectAllChildren"]){ // Mozilla
+				selection.selectAllChildren(element);
+			}
+		}
+	},
+	getBookmark: function(){
+		// summary: Retrieves a bookmark that can be used with moveToBookmark to return to the same range
+		var bookmark;
+		var _document = dojo.doc();
+		if(_document["selection"]){ // IE
+			var range = _document.selection.createRange();
+			bookmark = range.getBookmark();
+		}else{
+			var selection;
+			try {selection = dojo.global().getSelection();}
+			catch (e) {}
+			if(selection){
+				var range = selection.getRangeAt(0);
+				bookmark = range.cloneRange();
+			}else{
+				dojo.debug("No idea how to store the current selection for this browser!");
+			}
+		}
+		return bookmark;
+	},
+	moveToBookmark: function(/*Object*/bookmark){
+		// summary: Moves current selection to a bookmark
+		// bookmark: this should be a returned object from dojo.html.selection.getBookmark()
+		var _document = dojo.doc();
+		if(_document["selection"]){ // IE
+			var range = _document.selection.createRange();
+			 range.moveToBookmark(bookmark);
+			 range.select();
+		}else{ //Moz/W3C
+			var selection;
+			try {selection = dojo.global().getSelection();}
+			catch (e) {}
+			if(selection && selection['removeAllRanges']){
+				selection.removeAllRanges() ;
+				selection.addRange(bookmark) ;
+			}else{
+				dojo.debug("No idea how to restore selection for this browser!");
+			}
+		}
+	},
+	collapse: function(/*Boolean*/beginning) {
+		// summary: clear current selection
+		if(dojo.global()['getSelection']){
+			var selection = dojo.global().getSelection();
+			if(selection.removeAllRanges){ // Mozilla
+				if(beginning){
+					selection.collapseToStart();
+				}else{
+					selection.collapseToEnd();
+				}
+			}else{ // Safari
+				// pulled from WebCore/ecma/kjs_window.cpp, line 2536
+				 dojo.global().getSelection().collapse(beginning);
+			}
+		}else if(dojo.doc().selection){ // IE
+			var range = dojo.doc().selection.createRange();
+			range.collapse(beginning);
+			range.select();
+		}
+	},
+	remove: function() {
+		// summary: delete current selection
+		if(dojo.doc().selection) { //IE
+			var selection = dojo.doc().selection;
+
+			if ( selection.type.toUpperCase() != "NONE" ){
+				selection.clear();
+			}
+		
+			return selection;
+		}else{
+			var selection = dojo.global().getSelection();
+
+			for ( var i = 0; i < selection.rangeCount; i++ ){
+				selection.getRangeAt(i).deleteContents();
+			}
+		
+			return selection;
+		}
+	}
+});

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/selection.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/shadow.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/shadow.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/shadow.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/shadow.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,16 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.shadow");
+
+dojo.require("dojo.lfx.shadow");
+dojo.deprecated("dojo.html.shadow has been moved to dojo.lfx.", "0.5");
+
+dojo.html.shadow = dojo.lfx.shadow;

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/shadow.js
------------------------------------------------------------------------------
    svn:eol-style = native