diff options
author | jeresig <jeresig@gmail.com> | 2010-10-22 02:16:14 -0400 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-10-22 02:16:14 -0400 |
commit | 7e02cee5ff8b5e9117366d7b43af7b5794f0f258 (patch) | |
tree | 5a8fffbf971d2f34ab7d902d7f3d2b252e567b55 /src | |
parent | d9a3e0080a4ffe472a2ee4458b223fb1feb8021c (diff) | |
download | jquery-7e02cee5ff8b5e9117366d7b43af7b5794f0f258.tar.gz jquery-7e02cee5ff8b5e9117366d7b43af7b5794f0f258.zip |
Make sure that the correct height/width of the elements is retreived. Fixes #7225.
Diffstat (limited to 'src')
-rw-r--r-- | src/css.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/css.js b/src/css.js index f2165f904..88c4ffa05 100644 --- a/src/css.js +++ b/src/css.js @@ -169,11 +169,23 @@ jQuery.each(["height", "width"], function( i, name ) { }); } - if ( val < 0 || val === 0 && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { + if ( val < 0 ) { return elem.style[ name ] || "0px"; } - return val + "px"; + if ( val === 0 ) { + val = curCSS( elem, name, name ); + + if ( val != null ) { + return val; + } + } + + if ( val < 0 || val == null ) { + return elem.style[ name ]; + } + + return typeof val === "string" ? val : val + "px"; } }, |