diff options
author | jeresig <jeresig@gmail.com> | 2011-01-17 15:50:20 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2011-01-17 15:50:20 -0500 |
commit | f01ef93aab1d2e90efbcacc71b01180f7f33656b (patch) | |
tree | 560bfa849f4c55ecf066a7d283ca95eac39388b5 /src | |
parent | 987c44bee48557f693a59bc7ecc1bbe1718c428c (diff) | |
parent | 9bd9d270f69582b119b1835da4419a900f975b6b (diff) | |
download | jquery-f01ef93aab1d2e90efbcacc71b01180f7f33656b.tar.gz jquery-f01ef93aab1d2e90efbcacc71b01180f7f33656b.zip |
Merge branch '7608' of https://github.com/rwldrn/jquery into rwldrn-7608
Diffstat (limited to 'src')
-rw-r--r-- | src/css.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/css.js b/src/css.js index 8a83c6072..19c6342d2 100644 --- a/src/css.js +++ b/src/css.js @@ -263,8 +263,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) { if ( document.documentElement.currentStyle ) { currentStyle = function( elem, name ) { - var left, rsLeft, + var left, ret = elem.currentStyle && elem.currentStyle[ name ], + rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], style = elem.style; // From the awesome hack by Dean Edwards @@ -275,16 +276,19 @@ if ( document.documentElement.currentStyle ) { if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { // Remember the original values left = style.left; - rsLeft = elem.runtimeStyle.left; // Put in the new values to get a computed value out - elem.runtimeStyle.left = elem.currentStyle.left; + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } style.left = name === "fontSize" ? "1em" : (ret || 0); ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; - elem.runtimeStyle.left = rsLeft; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } } return ret === "" ? "auto" : ret; |