Fix #11724, $(document).height() in Firefox 12. Closes gh-802.

This reopens #3838 for IE6 which is a regression on a fix in 1.7.2, but we'd rather break a really old IE than a really recent Firefox.
This commit is contained in:
Mike Sherov 2012-05-29 08:46:00 -04:00 committed by Dave Methvin
parent 742872984e
commit ba70f8aeb6
3 changed files with 20 additions and 16 deletions

View File

@ -23,20 +23,14 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Get document width or height // Get document width or height
if ( elem.nodeType === 9 ) { if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
doc = elem.documentElement; doc = elem.documentElement;
// when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height] // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// so we can't use max, as it'll choose the incorrect offset[Width/Height] // unfortunately, this causes bug #3838 in IE6 only, but there is currently no good, small way to fix it.
// instead we use the correct client[Width/Height]
// support:IE6
if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
return doc[ clientProp ];
}
return Math.max( return Math.max(
elem.body[ scrollProp ], doc[ scrollProp ], elem.body[ scrollProp ], doc[ scrollProp ],
elem.body[ offsetProp ], doc[ offsetProp ] elem.body[ offsetProp ], doc[ offsetProp ],
doc[ clientProp ]
); );
} }

View File

@ -2,6 +2,16 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
html {
/**
* we need to null out border-width, because it causes bug #3838
* and until we drop IE6, this test will fail in IE6 if we didn't
* special case this situation.
**/
border-width: 0;
}
</style>
</head> </head>
<body> <body>
<div> <div>