diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-05-25 19:49:50 -0400 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-05-25 19:49:50 -0400 |
commit | edb2286544270dc53550180e06668e61c231fb5d (patch) | |
tree | e89dae0250f8c57839e160d2a4d5cf7e104b562b /src/dimensions.js | |
parent | 1d1cb582c0f744afaa51a63d374b9ffe0f58d1db (diff) | |
download | jquery-edb2286544270dc53550180e06668e61c231fb5d.tar.gz jquery-edb2286544270dc53550180e06668e61c231fb5d.zip |
Return null for outer/inner width/height calls on window/document. Fixes #7557.
Diffstat (limited to 'src/dimensions.js')
-rw-r--r-- | src/dimensions.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dimensions.js b/src/dimensions.js index e2d411dd2..1ab92d1dd 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -7,15 +7,17 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { // innerHeight and innerWidth jQuery.fn["inner" + name] = function() { - return this[0] ? - parseFloat( jQuery.css( this[0], type, "padding" ) ) : + var ret; + return this[0] && !isNaN( ret = parseFloat(jQuery.css( this[0], type, "padding" )) ) ? + ret : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function( margin ) { - return this[0] ? - parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) : + var ret; + return this[0] && !isNaN( ret = parseFloat(jQuery.css( this[0], type, margin ? "margin" : "border" )) ) ? + ret : null; }; |