diff --git a/src/offset.js b/src/offset.js index 1ee14058..6216b69d 100644 --- a/src/offset.js +++ b/src/offset.js @@ -5,8 +5,8 @@ if ( "getBoundingClientRect" in document.documentElement ) if ( elem === elem.ownerDocument.body ) return jQuery.offset.bodyOffset( elem ); var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, - top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, - left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; + top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, + left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; return { top: top, left: left }; }; else @@ -29,13 +29,13 @@ else if ( elem === offsetParent ) { top += elem.offsetTop, left += elem.offsetLeft; if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) - top += parseFloat( computedStyle.borderTopWidth, 10) || 0, - left += parseFloat( computedStyle.borderLeftWidth, 10) || 0; + top += parseFloat( computedStyle.borderTopWidth, 10 ) || 0, + left += parseFloat( computedStyle.borderLeftWidth, 10 ) || 0; prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; } if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) - top += parseFloat( computedStyle.borderTopWidth, 10) || 0, - left += parseFloat( computedStyle.borderLeftWidth, 10) || 0; + top += parseFloat( computedStyle.borderTopWidth, 10 ) || 0, + left += parseFloat( computedStyle.borderLeftWidth, 10 ) || 0; prevComputedStyle = computedStyle; } @@ -44,28 +44,28 @@ else left += body.offsetLeft; if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) - top += Math.max(docElem.scrollTop, body.scrollTop), - left += Math.max(docElem.scrollLeft, body.scrollLeft); + top += Math.max( docElem.scrollTop, body.scrollTop ), + left += Math.max( docElem.scrollLeft, body.scrollLeft ); return { top: top, left: left }; }; jQuery.offset = { initialize: function() { - var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, prop, bodyMarginTop = parseFloat(jQuery.curCSS(body, 'marginTop', true), 10) || 0, + var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0, html = '