diff options
author | scottjehl <scott@scottjehl.com> | 2010-12-22 15:24:07 -0500 |
---|---|---|
committer | scottjehl <scott@scottjehl.com> | 2010-12-22 15:24:07 -0500 |
commit | 18fa1fd9da12fd6a259b422f91b663d9fbdb181e (patch) | |
tree | 3c43cb96c8a13f8f5ab8366f35c0f7e0a826bcf4 /src | |
parent | 291b1edf444f30d9360a42c8d563e26eaf1a2ddb (diff) | |
download | jquery-18fa1fd9da12fd6a259b422f91b663d9fbdb181e.tar.gz jquery-18fa1fd9da12fd6a259b422f91b663d9fbdb181e.zip |
Getting window dimensions currently fails in Nokia browsers, causing JS error (and consequently making jQuery Mobile fail to render the page). Based on a tip from Ben Nolan, this fix returns window.screen[width|height] if the other attempts at getting window dimensions fail. On mobile at least, it seems to make sense, and on desktop (assuming this issue would ever show up on desktop), this might be better than returning false or undefined.
Diffstat (limited to 'src')
-rw-r--r-- | src/dimensions.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dimensions.js b/src/dimensions.js index f35b0acfb..b4dae83c4 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -36,7 +36,7 @@ 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 ]; + elem.document.body[ "client" + name ] || window.screen && window.screen[ name ]; // Get document width or height } else if ( elem.nodeType === 9 ) { |