From: jeresig Date: Fri, 25 Mar 2011 02:10:38 +0000 (-0400) Subject: Merge branch 'bug-3333' of https://github.com/rdworth/jquery X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=ee81d4da920ffeddff4e47ee09ca1a63b33768b4;hp=23e8cc560809fa108c922f8930eeaef775867ce8;p=jquery.git Merge branch 'bug-3333' of https://github.com/rdworth/jquery --- diff --git a/src/css.js b/src/css.js index 1e3f6c1..2eeef6c 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; } };