Skip to content
Permalink
Browse files

Getting the width and height of the document now returns the correct …

…value in all browsers. It even works around the scrollWidth == offsetWidth bug in Firefox thanks to wizzud.
  • Loading branch information
brandonaaron committed Dec 13, 2007
1 parent e1af5fa commit 3e3b86c7a7437c7b0416a2ac8385cf9403fc9e28
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/core.js
@@ -1311,8 +1311,11 @@ jQuery.each([ "Height", "Width" ], function(i, name){

// Get document width or height
this[0] == document ?
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater (Mozilla reports scrollWidth the same as offsetWidth)
Math.max( document.body[ "scroll" + name ], document.body[ "offset" + name ] ) :
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
Math.max(
Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
Math.max(document.body["offset" + name], document.documentElement["offset" + name])
) :

// Get or set width or height on the element
size == undefined ?

0 comments on commit 3e3b86c

Please sign in to comment.
You can’t perform that action at this time.