aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorMichał Gołębiowski <m.goleb@gmail.com>2013-09-06 18:33:55 +0200
committerMichał Gołębiowski <m.goleb@gmail.com>2013-09-06 18:33:55 +0200
commit1f16b168594f5b98341fd7db0b9fb5b3e84217c8 (patch)
tree939b84f3ca52bc2125adc73a101e43543fadc790 /src/css.js
parent73e120116ce13b992d5229b3e10fcc19f9505a15 (diff)
downloadjquery-1f16b168594f5b98341fd7db0b9fb5b3e84217c8.tar.gz
jquery-1f16b168594f5b98341fd7db0b9fb5b3e84217c8.zip
No ticket. Optimize the marginRight hook: run the support test once only.
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/css.js b/src/css.js
index fc59205b1..a3b9c935b 100644
--- a/src/css.js
+++ b/src/css.js
@@ -458,13 +458,18 @@ jQuery.cssHooks.marginRight = {
delete jQuery.cssHooks.marginRight;
return;
}
- 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" ] );
- }
+
+ 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 );
}
};
@@ -480,6 +485,7 @@ jQuery.each( [ "top", "left" ], function( i, prop ) {
delete jQuery.cssHooks[ prop ];
return;
}
+
jQuery.cssHooks[ prop ].get = function ( i, prop ) {
if ( computed ) {
computed = curCSS( elem, prop );
@@ -489,6 +495,7 @@ jQuery.each( [ "top", "left" ], function( i, prop ) {
computed;
}
};
+
return jQuery.cssHooks[ prop ].get( i, prop );
}
};