aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
authorBrandon Aaron <brandon.aaron@gmail.com>2008-05-15 20:29:52 +0000
committerBrandon Aaron <brandon.aaron@gmail.com>2008-05-15 20:29:52 +0000
commit82ba3709eec42dd8da33eb2023fda927166260eb (patch)
tree054a84d5d95019aeefa1a60512e80bcfeac3e2c6 /src/offset.js
parentde6520b50e481ba588e9021abcab16d06ea61141 (diff)
downloadjquery-82ba3709eec42dd8da33eb2023fda927166260eb.tar.gz
jquery-82ba3709eec42dd8da33eb2023fda927166260eb.zip
Reverted back to using the num helper method in offset.js
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/offset.js b/src/offset.js
index b77a0cdb5..ef999d8a4 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -112,12 +112,14 @@ jQuery.fn.extend({
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
- offset.top -= parseInt( jQuery.curCSS( this[0], 'marginTop', true ), 10 ) || 0;
- offset.left -= parseInt( jQuery.curCSS( this[0], 'marginLeft', true ), 10 ) || 0;
+ // 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 -= num( this, 'marginTop' );
+ offset.left -= num( this, 'marginLeft' );
// Add offsetParent borders
- parentOffset.top += parseInt( jQuery.curCSS( offsetParent[0], 'borderTopWidth', true ), 10 ) || 0;
- parentOffset.left += parseInt( jQuery.curCSS( offsetParent[0], 'borderLeftWidth', true ), 10 ) || 0;
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
+ parentOffset.left += num( offsetParent, 'borderLeftWidth' );
// Subtract the two offsets
results = {