Skip to content

Commit

Permalink
Reverted back to using the num helper method in offset.js
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonaaron committed May 15, 2008
1 parent de6520b commit 82ba370
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/offset.js
Expand Up @@ -112,12 +112,14 @@ jQuery.fn.extend({
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();


// Subtract element margins // Subtract element margins
offset.top -= parseInt( jQuery.curCSS( this[0], 'marginTop', true ), 10 ) || 0; // note: when an element has margin: auto the offsetLeft and marginLeft
offset.left -= parseInt( jQuery.curCSS( this[0], 'marginLeft', true ), 10 ) || 0; // 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 // Add offsetParent borders
parentOffset.top += parseInt( jQuery.curCSS( offsetParent[0], 'borderTopWidth', true ), 10 ) || 0; parentOffset.top += num( offsetParent, 'borderTopWidth' );
parentOffset.left += parseInt( jQuery.curCSS( offsetParent[0], 'borderLeftWidth', true ), 10 ) || 0; parentOffset.left += num( offsetParent, 'borderLeftWidth' );


// Subtract the two offsets // Subtract the two offsets
results = { results = {
Expand Down

0 comments on commit 82ba370

Please sign in to comment.