Apply CSS shorthand expansion to IE8 only
Closes #1953.
Andreas Svensson committed
Jul 29, 2014 at 23:06 UTC
f4f22a0baa3c0e12d3303029e02bacf115f6b597
1 file changed
+11
-1
src/renderers/dom/shared/CSSPropertyOperations.js
+11
-1
@@ -25,8 +25,16 @@ var processStyleName = memoizeStringOnly(function(styleName) {
25
return hyphenateStyleName(styleName);
26
});
27
28
+var hasShorthandPropertyBug = false;
29
var styleFloatAccessor = 'cssFloat';
30
if (ExecutionEnvironment.canUseDOM) {
31
+ var tempStyle = document.createElement('div').style;
32
+ try {
33
+ // IE8 throws "Invalid argument." if resetting shorthand style properties.
34
+ tempStyle.font = '';
35
+ } catch (e) {
36
+ hasShorthandPropertyBug = true;
37
+ }
38
// IE8 only supports accessing cssFloat (standard) as styleFloat
39
if (document.documentElement.style.cssFloat === undefined) {
40
styleFloatAccessor = 'styleFloat';
@@ -159,7 +167,9 @@ var CSSPropertyOperations = {
167
if (styleValue) {
168
style[styleName] = styleValue;
169
} else {
162
- var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
170
+ var expansion =
171
+ hasShorthandPropertyBug &&
172
+ CSSProperty.shorthandPropertyExpansions[styleName];
173
if (expansion) {
174
// Shorthand property that IE8 won't like unsetting, so unset each
175
// component to placate it