diff options
author | Brandon Aaron <brandon.aaron@gmail.com> | 2007-12-04 20:54:23 +0000 |
---|---|---|
committer | Brandon Aaron <brandon.aaron@gmail.com> | 2007-12-04 20:54:23 +0000 |
commit | e317bb7105c1288a6fbce03725013daebf095d25 (patch) | |
tree | a6cea5722003ef0402e57673e2d22a0ec0158618 /src | |
parent | f576ceeea9eea5fec6b31172765df4da8b264ac8 (diff) | |
download | jquery-e317bb7105c1288a6fbce03725013daebf095d25.tar.gz jquery-e317bb7105c1288a6fbce03725013daebf095d25.zip |
offset now uses clientLeft and clientTop instead of calculating html border in IE
Diffstat (limited to 'src')
-rw-r--r-- | src/offset.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/offset.js b/src/offset.js index 895214a43..e74556cd2 100644 --- a/src/offset.js +++ b/src/offset.js @@ -23,13 +23,12 @@ jQuery.fn.offset = function() { ); // IE adds the HTML element's border, by default it is medium which is 2px - // IE 6 and IE 7 quirks mode the border width is overwritable by the following css html { border: 0; } + // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; } // IE 7 standards mode, the border is always 2px - if ( msie ) { - var border = jQuery("html").css("borderWidth"); - border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border; - add( -border, -border ); - } + // This border/offset is typically represented by the clientLeft and clientTop properties + // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS + // Therefore this method will be off by 2px in IE while in quirksmode + add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop ); // Otherwise loop through the offsetParents and parentNodes } else { |