diff options
author | John Resig <jeresig@gmail.com> | 2009-12-09 21:58:29 -0800 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-12-09 21:58:29 -0800 |
commit | a5f8a1441158b66efb76de1d15f061f87f7bdc17 (patch) | |
tree | 179d7723da7c747771594cc5a5669b3d3bdb333a /src/dimensions.js | |
parent | 715d1c5a30cc4986018bbf063713f14c34c3e258 (diff) | |
download | jquery-a5f8a1441158b66efb76de1d15f061f87f7bdc17.tar.gz jquery-a5f8a1441158b66efb76de1d15f061f87f7bdc17.zip |
Make sure that calling .width(num) or .height(num) on an empty set returns the empty set. Fixes #5600.
Diffstat (limited to 'src/dimensions.js')
-rw-r--r-- | src/dimensions.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dimensions.js b/src/dimensions.js index 3b74ded9b..d3c8418db 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -20,7 +20,10 @@ jQuery.each([ "Height", "Width" ], function(i, name){ jQuery.fn[ type ] = function( size ) { // Get window width or height var elem = this[0]; - if ( !elem ) { return null; } + if ( !elem ) { + return size == null ? null : this; + } + return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window? // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || |