aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2011-03-24 19:55:55 -0400
committerRichard Worth <rdworth@gmail.com>2011-03-24 19:55:55 -0400
commit735a949a0649f0299e8e4d87b259290970a68ddf (patch)
tree5a73c918cfd6caa3de957d55e3c34950812337a7 /src/css.js
parent7b985c4ca0cc687998302483000f2dcf9dcb9bce (diff)
downloadjquery-735a949a0649f0299e8e4d87b259290970a68ddf.tar.gz
jquery-735a949a0649f0299e8e4d87b259290970a68ddf.zip
Further fix for #3333, refactored marginRight css hook to use jQuery.swap and computed. Thanks timmywil
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/css.js b/src/css.js
index 1e3f6c166..2eeef6cc9 100644
--- a/src/css.js
+++ b/src/css.js
@@ -248,11 +248,14 @@ jQuery(function() {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
- var ret = "0px",
- display = elem.style.display;
- elem.style.display = "inline-block";
- ret = getComputedStyle( elem, "margin-right", "margin-right" );
- elem.style.display = display;
+ var ret;
+ jQuery.swap( elem, { "display": "inline-block" }, function() {
+ if ( computed ) {
+ ret = curCSS( elem, "margin-right", "marginRight" );
+ } else {
+ ret = elem.style.marginRight;
+ }
+ });
return ret;
}
};