aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2015-05-07 23:16:18 -0400
committerRichard Gibson <richard.gibson@gmail.com>2015-10-18 16:58:38 -0400
commit487d5ca913c237aafe9efa1179749b46382fddbf (patch)
tree80ba81e17553a2076ccc3e49999f533a8ad0ea27 /src/css.js
parentc752a5030bc00eb5b45dea9c28963f824a5c4f44 (diff)
downloadjquery-487d5ca913c237aafe9efa1179749b46382fddbf.tar.gz
jquery-487d5ca913c237aafe9efa1179749b46382fddbf.zip
CSS: Correct misrepresentation of "auto" horizontal margins as 0
Fixes gh-2237 Closes gh-2276 (cherry picked from commit 214e1634ab9b1d13d53647dd5de3bdf7a091d49c) Conflicts: src/css.js src/css/support.js test/unit/support.js
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/css.js b/src/css.js
index 4fbc6745e..0e5a55610 100644
--- a/src/css.js
+++ b/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: "",