mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 15:34:56 -05:00
CSS: Correct misrepresentation of "auto" horizontal margins as 0
Fixes gh-2237
Closes gh-2276
(cherry picked from commit 214e1634ab)
Conflicts:
src/css.js
src/css/support.js
test/unit/support.js
This commit is contained in:
13
src/css.js
13
src/css.js
@@ -350,6 +350,19 @@ jQuery.each( [ "height", "width" ], function( i, name ) {
|
||||
};
|
||||
} );
|
||||
|
||||
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
|
||||
function( elem, computed ) {
|
||||
if ( computed ) {
|
||||
return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
|
||||
elem.getBoundingClientRect().left -
|
||||
swap( elem, { marginLeft: 0 }, function() {
|
||||
return elem.getBoundingClientRect().left;
|
||||
} )
|
||||
) + "px";
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// These hooks are used by animate to expand properties
|
||||
jQuery.each( {
|
||||
margin: "",
|
||||
|
||||
Reference in New Issue
Block a user