}
// Get parent scroll offsets
- while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
+ while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) )
// Subtract parent scroll offsets
// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) ||
- (mozilla && jQuery.css(offsetChild, "position") != "absoltue") )
+ (mozilla && jQuery.css(offsetChild, "position") != "absolute") )
add( -doc.body.offsetLeft, -doc.body.offsetTop );
// Add the document scroll offsets if position is fixed
results = { top: top, left: left };
}
- return results;
-
function border(elem) {
- add( jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") );
+ add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
}
function add(l, t) {
left += parseInt(l) || 0;
top += parseInt(t) || 0;
}
+
+ return results;
};