This affects Prototype 1.6.0
Currently the Element.positionedOffset function stops recursing when it finds a relative or absolutely positioned element. This is incorrect since it ignores the "fixed" position. Elsewhere in the code, the logic simply checks for !static which is more inclusive and also (technically) a faster check.
The easy fix, shown below is to check for !static.
Patch
positionedOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
if (element) {
if (element.tagName == 'BODY') break;
var p = Element.getStyle(element, 'position');
if (p != 'static') break;
}
} while (element);
return Element._returnOffset(valueL, valueT);
},
Example:
<div style="position:fixed; top:100px;">
<a onclick="alert($(this).positionedOffset())">Click Here to see the wrong offset</a>
</div>