Merge branch 'master' of git://github.com/jquery/jquery into fixedbuild
[jquery.git] / src / css.js
index 19c6342..2eeef6c 100644 (file)
@@ -240,6 +240,28 @@ if ( !jQuery.support.opacity ) {
        };
 }
 
+jQuery(function() {
+       // This hook cannot be added until DOM ready because the support test
+       // for it is not run until after DOM ready
+       if ( !jQuery.support.reliableMarginRight ) {
+               jQuery.cssHooks.marginRight = {
+                       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;
+                               jQuery.swap( elem, { "display": "inline-block" }, function() {
+                                       if ( computed ) {
+                                               ret = curCSS( elem, "margin-right", "marginRight" );
+                                       } else {
+                                               ret = elem.style.marginRight;
+                                       }
+                               });
+                               return ret;
+                       }
+               };
+       }
+});
+
 if ( document.defaultView && document.defaultView.getComputedStyle ) {
        getComputedStyle = function( elem, newName, name ) {
                var ret, defaultView, computedStyle;
@@ -263,7 +285,7 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
 
 if ( document.documentElement.currentStyle ) {
        currentStyle = function( elem, name ) {
-               var left, 
+               var left,
                        ret = elem.currentStyle && elem.currentStyle[ name ],
                        rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
                        style = elem.style;