diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2013-09-11 02:45:11 +0200 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2013-09-11 02:45:11 +0200 |
commit | 0b9f0343824526c2b218c313aebeeab3d41d1c96 (patch) | |
tree | 1e1f63700f40202c14dec96c00efbdd2e5d1856c /src/css.js | |
parent | 4ded9be72a724a79d764a4fc72ea9450322235a8 (diff) | |
download | jquery-0b9f0343824526c2b218c313aebeeab3d41d1c96.tar.gz jquery-0b9f0343824526c2b218c313aebeeab3d41d1c96.zip |
No ticket. Abstract conditional hook definition.
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/css.js b/src/css.js index 23cd73c81..4e80b3216 100644 --- a/src/css.js +++ b/src/css.js @@ -14,6 +14,7 @@ var curCSS = require( "./css/curCSS" ), support = require( "./css/support" ), defaultDisplay = require( "./css/defaultDisplay" ), + addGetHookIf = require( "./css/addGetHookIf" ), data_priv = require( "./data/var/data_priv" ), // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" @@ -369,28 +370,16 @@ jQuery.each([ "height", "width" ], function( i, name ) { }); // Support: Android 2.3 -jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - if ( support.reliableMarginRight() ) { - // Hook not needed, remove it. - // Since there are no other hooks for marginRight, remove the whole object. - delete jQuery.cssHooks.marginRight; - return; +addGetHookIf( jQuery.cssHooks.marginRight, support.reliableMarginRight, + function ( elem, computed ) { + if ( computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, + curCSS, [ elem, "marginRight" ] ); } - - jQuery.cssHooks.marginRight.get = function( elem, computed ) { - if ( computed ) { - // Support: Android 2.3 - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, - curCSS, [ elem, "marginRight" ] ); - } - }; - - return jQuery.cssHooks.marginRight.get( elem, computed ); } -}; +); // These hooks are used by animate to expand properties jQuery.each({ |