aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2012-12-10 18:25:23 -0500
committerMike Sherov <mike.sherov@gmail.com>2012-12-11 13:58:14 -0500
commita918dc8aacb8461321c332f6f3b5756bdda5e8b2 (patch)
tree0824e7f8d49426f510a0982954b1d48be6cc5de8 /src/offset.js
parentaa0e4aadd56002928d429af771b26114493486ac (diff)
downloadjquery-a918dc8aacb8461321c332f6f3b5756bdda5e8b2.tar.gz
jquery-a918dc8aacb8461321c332f6f3b5756bdda5e8b2.zip
Pass style declarations around for performance improvements and paving the way for the css array signature
Also, simplify the jQuery.css numeric coercion signature
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/offset.js b/src/offset.js
index 93446eae4..04c94cade 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -108,16 +108,16 @@ jQuery.fn.extend({
}
// Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css( offsetParent[ 0 ], "borderTopWidth" ) ) || 0;
- parentOffset.left += parseFloat( jQuery.css( offsetParent[ 0 ], "borderLeftWidth" ) ) || 0;
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and 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
return {
- top: offset.top - parentOffset.top - ( parseFloat( jQuery.css( elem, "marginTop" ) ) || 0 ),
- left: offset.left - parentOffset.left - ( parseFloat( jQuery.css( elem, "marginLeft" ) ) || 0 )
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},