File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,14 @@ jQuery.fn.extend({
112
112
parentOffset = / ^ b o d y | h t m l $ / i. test ( offsetParent [ 0 ] . tagName ) ? { top : 0 , left : 0 } : offsetParent . offset ( ) ;
113
113
114
114
// Subtract element margins
115
- offset . top -= parseInt ( jQuery . curCSS ( this [ 0 ] , 'marginTop' , true ) , 10 ) || 0 ;
116
- offset . left -= parseInt ( jQuery . curCSS ( this [ 0 ] , 'marginLeft' , true ) , 10 ) || 0 ;
115
+ // note: when an element has margin: auto the offsetLeft and marginLeft
116
+ // are the same in Safari causing offset.left to incorrectly be 0
117
+ offset . top -= num ( this , 'marginTop' ) ;
118
+ offset . left -= num ( this , 'marginLeft' ) ;
117
119
118
120
// Add offsetParent borders
119
- parentOffset . top += parseInt ( jQuery . curCSS ( offsetParent [ 0 ] , 'borderTopWidth' , true ) , 10 ) || 0 ;
120
- parentOffset . left += parseInt ( jQuery . curCSS ( offsetParent [ 0 ] , 'borderLeftWidth' , true ) , 10 ) || 0 ;
121
+ parentOffset . top += num ( offsetParent , 'borderTopWidth' ) ;
122
+ parentOffset . left += num ( offsetParent , 'borderLeftWidth' ) ;
121
123
122
124
// Subtract the two offsets
123
125
results = {
You can’t perform that action at this time.
0 commit comments