diff options
author | scottjehl <scott@scottjehl.com> | 2011-01-19 12:40:32 -0500 |
---|---|---|
committer | scottjehl <scott@scottjehl.com> | 2011-01-19 12:40:32 -0500 |
commit | 2b64b1db6877f52ea2958c6aafb0e4644fbcfe13 (patch) | |
tree | 31b1ac8b06fcb2920ce2b897f85c560a42111efa | |
parent | cb1f7eeac5073748ae6200f2f960fb330ec966a8 (diff) | |
download | jquery-2b64b1db6877f52ea2958c6aafb0e4644fbcfe13.tar.gz jquery-2b64b1db6877f52ea2958c6aafb0e4644fbcfe13.zip |
Revised the Nokia support fallback. It turns out that Nokia supports the documentElement property but does not define document.compatMode. Adding this third fallback allows Nokia to run jQuery error-free and return proper values for window width and height.
-rw-r--r-- | src/dimensions.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dimensions.js b/src/dimensions.js index 9d8c35454..e2d411dd2 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -35,8 +35,10 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { if ( jQuery.isWindow( elem ) ) { // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode - return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || - elem.document.body[ "client" + name ] || window.screen && window.screen[ name.toLowerCase() ]; + // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat + var docElemProp = elem.document.documentElement[ "client" + name ]; + return elem.document.compatMode === "CSS1Compat" && docElemProp || + elem.document.body[ "client" + name ] || docElemProp; // Get document width or height } else if ( elem.nodeType === 9 ) { |