in plugins/struts2-dojo-plugin/src/main/resources/org/apache/struts2/static/dojo/src/html/layout.js [67:164]
dojo.html.getAbsolutePosition = dojo.html.abs = function (node, includeScroll, boxType) {
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;
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) {
nativeBoxType = 1;
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) {
}
} else {
if (node["offsetParent"]) {
var endNode;
if ((h.safari) && (node.style.getPropertyValue("position") == "absolute") && (node.parentNode == db)) {
endNode = db;
} else {
endNode = db.parentNode;
}
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"];
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;
}
}
}
}
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;
};