Further fix for #3333, refactored marginRight css hook to use jQuery.swap and computed. Thanks timmywil

This commit is contained in:
Richard Worth 2011-03-24 19:55:55 -04:00
parent 7b985c4ca0
commit 735a949a06

View file

@ -248,11 +248,14 @@ jQuery(function() {
get: function( elem, computed ) { get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block // Work around by temporarily setting element display to inline-block
var ret = "0px", var ret;
display = elem.style.display; jQuery.swap( elem, { "display": "inline-block" }, function() {
elem.style.display = "inline-block"; if ( computed ) {
ret = getComputedStyle( elem, "margin-right", "margin-right" ); ret = curCSS( elem, "margin-right", "marginRight" );
elem.style.display = display; } else {
ret = elem.style.marginRight;
}
});
return ret; return ret;
} }
}; };