Skip to content

Commit 735a949

Browse files
committed
Further fix for jquery#3333, refactored marginRight css hook to use jQuery.swap and computed. Thanks timmywil
1 parent 7b985c4 commit 735a949

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/css.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,14 @@ jQuery(function() {
248248
get: function( elem, computed ) {
249249
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
250250
// Work around by temporarily setting element display to inline-block
251-
var ret = "0px",
252-
display = elem.style.display;
253-
elem.style.display = "inline-block";
254-
ret = getComputedStyle( elem, "margin-right", "margin-right" );
255-
elem.style.display = display;
251+
var ret;
252+
jQuery.swap( elem, { "display": "inline-block" }, function() {
253+
if ( computed ) {
254+
ret = curCSS( elem, "margin-right", "marginRight" );
255+
} else {
256+
ret = elem.style.marginRight;
257+
}
258+
});
256259
return ret;
257260
}
258261
};

0 commit comments

Comments
 (0)