rem: if(dojo.boxModel == "border-box"){ 
add: if(dojo.boxMode == "border-box"){ 
context: (function(){	var _insertBefore = function(/*Node*/node, /*Node*/ref){		ref.parentNode.insertBefore(node, ref);		return true;	//	boolean	}	var _insertAfter = function(/*Node*/node, /*Node*/ref){		//	summary:		//		Try to insert node after ref		var pn = ref.parentNode;		if(ref == pn.lastChild){			pn.appendChild(node);		}else{			return _insertBefore(node, ref.nextSibling);	//	boolean		}		return true;	//	boolean	}	dojo.place = function(/*DOMNode*/node, /*DOMNode*/refNode, /*String*/position){		//	summary:		//		attempt to insert node in relation to ref based		//		on position		// FIXME: need to write tests for this!!!!		if((!node)||(!refNode)||(!position)){ 			return false;	//	boolean 		}		if(typeof position == "number"){			var cn = refNode.childNodes;			if(((position == 0)&&(cn.length == 0)) ||				(cn.length == position)){				refNode.appendChild(node); return true;			}			if(position == 0){				return _insertBefore(node, refNode.firstChild);			}			return _insertAfter(node, cn[position-1]);		}		switch(position.toLowerCase()){			case "before":				return _insertBefore(node, refNode);	//	boolean			case "after":				return _insertAfter(node, refNode);		//	boolean			case "first":				if(refNode.firstChild){					return _insertBefore(node, refNode.firstChild);	//	boolean				}else{					refNode.appendChild(node);					return true;	//	boolean				}				break;			default: // aka: last				refNode.appendChild(node);				return true;	//	boolean		}	}	// can be either:	//	"border-box"	//	"content-box" (default)	dojo.boxMode = "content-box"	if(dojo.isIE){		// IE branch		var _d = document;		var _toPixelValue = function(element, avalue){			// parseInt or parseFloat? (style values can be floats)			if(avalue.slice(-2) == "px"){ return parseFloat(avalue); }			with(element){				var sLeft = style.left;				var rsLeft = runtimeStyle.left;				runtimeStyle.left = currentStyle.left;				try{					// 'avalue' may be incompatible with					// style.left, which can cause IE to throw					// this has been observed for border widths					// using "thin", "medium", "thick" constants					// those particular constants could be					// trapped by a lookup but perhaps there are					// more					style.left = avalue || 0;					avalue = style.pixelLeft;				}catch(e){					avalue = 0;				}				style.left = sLeft;				runtimeStyle.left = rsLeft;			}			return avalue;		}		var _dcm = _d.compatMode;		dojo.boxMode = ((_dcm=="BackCompat")||(_dcm=="QuirksMode")) ? "border-box" : "content-box";		dojo.getComputedStyle = function(node){			return node.currentStyle;		}	}else{		// non-IE branch		var _toPixelValue = function(element, value){			// parseInt or parseFloat? (style values can be floats)			return parseFloat(value) || 0; 		}		dojo.getComputedStyle = function(node){			return document.defaultView.getComputedStyle(node, null);		}		}	var _setBox = function(node, o, u){		u = u || "px";		with(node.style){			if(!isNaN(o.x)){ left = o.x + u; }			if(!isNaN(o.y)){ top = o.y + u; }			if(!isNaN(o.w)&&(o.w>=0)){ width = o.w + u; }			if(!isNaN(o.h)&&(o.h>=0)){ height = o.h + u; }		}	}	var _nilExtents = { w: 0, h: 0 };	var _getPixelizer = function(element){		// Can be microscopically faster by isolating the IE version and		// inlining toPixelValue here for all other browsers. Benchmarking		// indicated it is not worth the extra code. 		return function(value){			return _toPixelValue(element, value);		}	}	var _getPadBorderBounds = function(node, s){		// Values returned from this function are non-intuitve, but they are		// specifically useful for fitting nodes.  l, t = the top and left		// edges as determined by padding If 'node' has position, then these		// l/t form the origin for child nodes. 		// w = the total of the right padding and left and right border		// h = the total of the bottom padding and top and bottom border		// The w/h are used for calculating boxes.		// Normally application code will not need to invoke this directly, and		// will use the ...box... functions instead.		var px = _getPixelizer(node);		var l = px(s.paddingLeft), t = px(s.paddingTop);		var bw = (s.borderLeftStyle != 'none' ? px(s.borderLeftWidth) : 0) + (s.borderRightStyle != 'none' ? px(s.borderRightWidth) : 0);		var bh = (s.borderTopStyle != 'none' ? px(s.borderTopWidth) : 0) + (s.borderBottomStyle != 'none' ? px(s.borderBottomWidth) : 0);		return { 			w: l + bw + px(s.paddingRight),			h: t + bh + px(s.paddingBottom)		};	}	var _getMarginExtents = function(node, s){		var px = _getPixelizer(node);		return { 			w: px(s.marginLeft) + px(s.marginRight),			h: px(s.marginTop) + px(s.marginBottom)		};	}	var _getMarginBox = function(node, computedStyle){		var mb = _getMarginExtents(node, computedStyle);		return {			w: node.offsetWidth + mb.w, 			h: node.offsetHeight + mb.h		};	}	var _setMarginBox = function(node, wObj, s){		var pb = (dojo.boxMode == "border-box" ? _nilExtents : _getPadBorderBounds(node, s));		var mb = _getMarginExtents(node, s);		if(!isNaN(wObj.w)){			wObj.w = Math.max(wObj.w - pb.w - mb.w, 0);		}		if(!isNaN(wObj.h)){			wObj.h = Math.max(wObj.h - pb.h - mb.h, 0);		}		_setBox(node, wObj);	}	dojo.marginBox = function(node, boxObj){		node = dojo.byId(node);		var s = dojo.getComputedStyle(node);		if(boxObj){			return _setMarginBox(node, boxObj, s);		}		return _getMarginBox(node, s);	}	var _getContentBox = function(node, computedStyle){		var pb = _getPadBorderBounds(node, computedStyle);		return {			w: node.offsetWidth - pb.w,			h: node.offsetHeight- pb.h		};	}	var _setContentBox = function(node, boxObj, computedStyle){		if(dojo.boxModel == "border-box"){			var pb = _getPadBorderBounds(node, computedStyle);			if(!isNaN(boxObj.w)){ boxObj.w += pb.w; }			if(!isNaN(boxObj.h)){ boxObj.h += pb.h; }		}		_setBox(node, boxObj);	}	dojo.contentBox = function(node, boxObj){		node = dojo.byId(node);		var s = dojo.getComputedStyle(node);		if(boxObj){			return _setContentBox(node, boxObj, s);		}		return _getContentBox(node, s);	}	var _sumAncestorProperties = function(node, prop){		if(!node){ return 0; } // FIXME: throw an error?		var _b = dojo.body();		var retVal = 0;		while(node){			try{				if(dojo.getComputedStyle(node).position == "fixed"){					return 0;				}			}catch(e){}			var val = node[prop];			if(val){				retVal += val - 0;				// opera and khtml #body & #html has the same values, we only				// need one value				if(node == _b){ break; }			}			node = node.parentNode;		}		return retVal;	//	integer	}	var _docScroll = function(){		var _b = dojo.body();		var _w = dojo.global();		var de = dojo.doc().documentElement;		return {			y: (_w.pageYOffset || de.scrollTop || _b.scrollTop || 0),			x: (_w.pageXOffset || de.scrollLeft || _b.scrollLeft || 0)		};	};	var _abs = function(/*HTMLElement*/node, /*boolean?*/includeScroll){		//	summary		//		Gets the absolute position of the passed element based on the		//		document itself.		// FIXME: need to decide in the brave-new-world if we're going to be		// margin-box or border-box.		var ownerDocument = dojo.doc();		var ret = {			x: 0,			y: 0		};		// targetBoxType == "border-box"		var db = dojo.body();		if(dojo.isIE){			with(node.getBoundingClientRect()){				ret.x = left-2;				ret.y = top-2;			}		}else if(ownerDocument["getBoxObjectFor"]){			// mozilla			// try{				var bo = ownerDocument.getBoxObjectFor(node);				// console.debug(bo, node);				// console.debug(_sumAncestorProperties(node, "scrollLeft"));				ret.x = bo.x - _sumAncestorProperties(node, "scrollLeft");				ret.y = bo.y - _sumAncestorProperties(node, "scrollTop");				// console.debug(ret.y);			// }catch(e){				// console.debug(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(	(dojo.isSafari)&&					(node.style.getPropertyValue("position") == "absolute")&&					(node.parentNode == db)){					endNode = db;				}else{					endNode = db.parentNode;				}				if(node.parentNode != db){					var nd = node;					if(dojo.isOpera){ nd = db; }					ret.x -= _sumAncestorProperties(nd, "scrollLeft");					ret.y -= _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(!dojo.isOpera || 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 = _docScroll();			ret.y += scroll.y;			ret.x += scroll.x;		}		/*		// FIXME		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.t = ret.y;		// ret.l = ret.x;		return ret;	//	object	}	// FIXME: need a setter for coords or a moveTo!!	dojo.coords = function(node, includeScroll){		node = dojo.byId(node);		var s = dojo.getComputedStyle(node);		var mb = _getMarginBox(node, s);		var abs = _abs(node, includeScroll);		mb.x = abs.x;		mb.y = abs.y;		return mb;	}})();
meta: 4497	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/4497/52a519f77bdd8a32e330bda7636bc14eee6fd8f1/html.js/clean/_base/html.js