]> source.dussan.org Git - jquery.git/commitdiff
Further fix for #3333, refactored marginRight css hook to use jQuery.swap and compute... 287/head
authorRichard Worth <rdworth@gmail.com>
Thu, 24 Mar 2011 23:55:55 +0000 (19:55 -0400)
committerRichard Worth <rdworth@gmail.com>
Thu, 24 Mar 2011 23:55:55 +0000 (19:55 -0400)
src/css.js

index 1e3f6c1666f8af71613c848033eb6f6aff49ee09..2eeef6cc9d90cd03f980311f8f60ce1475c31f89 100644 (file)
@@ -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;
                        }
                };