Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix #3838, $(document).height() incorrect in IE6
May still be broken in Netscape Navigator 4.
- Loading branch information
Showing
with
51 additions
and 1 deletion.
- +9 −1 src/dimensions.js
- +17 −0 test/data/dimensions/documentLarge.html
- +11 −0 test/data/dimensions/documentSmall.html
- +14 −0 test/unit/dimensions.js
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 ] ) { | ||
This comment has been minimized.
This comment has been minimized.
mikesherov
Author
Member
|
||
return doc[ clientProp ]; | ||
} | ||
|
||
return Math.max( | ||
elem.body[ scrollProp ], doc[ scrollProp ], | ||
elem.body[ offsetProp ], doc[ offsetProp ] | ||
); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<style> | ||
body { | ||
width: 1000px; | ||
height: 1000px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<script src="../include_js.php"></script> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
</head> | ||
<body> | ||
<div> | ||
<script src="../include_js.php"></script> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your code comment mentions
offset
andclient
but your code in theif
statement checksclientProp
andscrollProp
instead ofclientProp
andoffsetProp
. Is the mixup intentional?