diff options
author | jeresig <jeresig@gmail.com> | 2010-09-16 10:00:56 -0400 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-09-16 10:00:56 -0400 |
commit | 37b607d2815b893d13de4ac3461090d0dd46535e (patch) | |
tree | 47b4f5dd980cd0ae20eb7dc6820672f45437e78d /src/offset.js | |
parent | 2131e1a7ad6d9df239ec00b301303e10dbd34d49 (diff) | |
download | jquery-37b607d2815b893d13de4ac3461090d0dd46535e.tar.gz jquery-37b607d2815b893d13de4ac3461090d0dd46535e.zip |
Split apart jQuery.css into jQuery.css (computed values) and jQuery.style (currently set values).
Diffstat (limited to 'src/offset.js')
-rw-r--r-- | src/offset.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/offset.js b/src/offset.js index 5d283aacf..c472f9852 100644 --- a/src/offset.js +++ b/src/offset.js @@ -105,7 +105,7 @@ if ( "getBoundingClientRect" in document.documentElement ) { jQuery.offset = { initialize: function() { - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop", undefined, true) ) || 0, + var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0, html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); @@ -144,8 +144,8 @@ jQuery.offset = { jQuery.offset.initialize(); if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.css(body, "marginTop", undefined, true) ) || 0; - left += parseFloat( jQuery.css(body, "marginLeft", undefined, true) ) || 0; + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; @@ -161,8 +161,8 @@ jQuery.offset = { var curElem = jQuery( elem ), curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top", undefined, true ), - curCSSLeft = jQuery.css( elem, "left", undefined, true ), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1), props = {}, curPosition = {}, curTop, curLeft; @@ -212,12 +212,12 @@ jQuery.fn.extend({ // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.css(elem, "marginTop", undefined, true) ) || 0; - offset.left -= parseFloat( jQuery.css(elem, "marginLeft", undefined, true) ) || 0; + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth", undefined, true) ) || 0; - parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth", undefined, true) ) || 0; + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { |