diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-02-25 13:13:16 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-03-02 11:45:30 -0500 |
commit | 5cae50e66e34c277412c01ccb1c24bd6a85d2d8a (patch) | |
tree | 471a098956d7ac8af0e1bcf74221b344d722e57d /src/dimensions.js | |
parent | da02e190b5fa57d56a6561ac64209c36c64c4ecd (diff) | |
download | jquery-5cae50e66e34c277412c01ccb1c24bd6a85d2d8a.tar.gz jquery-5cae50e66e34c277412c01ccb1c24bd6a85d2d8a.zip |
Fix #3838, $(document).height() incorrect in IE6
May still be broken in Netscape Navigator 4.
Diffstat (limited to 'src/dimensions.js')
-rw-r--r-- | src/dimensions.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/dimensions.js b/src/dimensions.js index 8069676eb..64da9f4f2 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -42,8 +42,16 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { if ( elem.nodeType === 9 ) { // Either scroll[Width/Height] or offset[Width/Height], whichever is greater doc = elem.documentElement; + + // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height] + // so we can't use max, as it'll choose the incorrect offset[Width/Height] + // instead we use the correct client[Width/Height] + // support:IE6 + if ( doc[ clientProp ] >= doc[ scrollProp ] ) { + return doc[ clientProp ]; + } + return Math.max( - doc[ clientProp ], elem.body[ scrollProp ], doc[ scrollProp ], elem.body[ offsetProp ], doc[ offsetProp ] ); |