Skip to content

Commit 2566b24

Browse files
authored
Remove IE8 property expansion workaround (#10803)
* Remove IE8 property expansion workaround * Edit from a plane ✈️
1 parent ccb2f82 commit 2566b24

2 files changed

Lines changed: 1 addition & 89 deletions

File tree

src/renderers/dom/shared/CSSProperty.js

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -82,71 +82,8 @@ Object.keys(isUnitlessNumber).forEach(function(prop) {
8282
});
8383
});
8484

85-
/**
86-
* Most style properties can be unset by doing .style[prop] = '' but IE8
87-
* doesn't like doing that with shorthand properties so for the properties that
88-
* IE8 breaks on, which are listed here, we instead unset each of the
89-
* individual properties. See http://bugs.jquery.com/ticket/12385.
90-
* The 4-value 'clock' properties like margin, padding, border-width seem to
91-
* behave without any problems. Curiously, list-style works too without any
92-
* special prodding.
93-
*/
94-
var shorthandPropertyExpansions = {
95-
background: {
96-
backgroundAttachment: true,
97-
backgroundColor: true,
98-
backgroundImage: true,
99-
backgroundPositionX: true,
100-
backgroundPositionY: true,
101-
backgroundRepeat: true,
102-
},
103-
backgroundPosition: {
104-
backgroundPositionX: true,
105-
backgroundPositionY: true,
106-
},
107-
border: {
108-
borderWidth: true,
109-
borderStyle: true,
110-
borderColor: true,
111-
},
112-
borderBottom: {
113-
borderBottomWidth: true,
114-
borderBottomStyle: true,
115-
borderBottomColor: true,
116-
},
117-
borderLeft: {
118-
borderLeftWidth: true,
119-
borderLeftStyle: true,
120-
borderLeftColor: true,
121-
},
122-
borderRight: {
123-
borderRightWidth: true,
124-
borderRightStyle: true,
125-
borderRightColor: true,
126-
},
127-
borderTop: {
128-
borderTopWidth: true,
129-
borderTopStyle: true,
130-
borderTopColor: true,
131-
},
132-
font: {
133-
fontStyle: true,
134-
fontVariant: true,
135-
fontWeight: true,
136-
fontSize: true,
137-
lineHeight: true,
138-
fontFamily: true,
139-
},
140-
outline: {
141-
outlineWidth: true,
142-
outlineStyle: true,
143-
outlineColor: true,
144-
},
145-
};
146-
14785
var CSSProperty = {
14886
isUnitlessNumber: isUnitlessNumber,
149-
shorthandPropertyExpansions: shorthandPropertyExpansions,
15087
};
15188

15289
module.exports = CSSProperty;

src/renderers/dom/shared/CSSPropertyOperations.js

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,13 @@
99

1010
'use strict';
1111

12-
var CSSProperty = require('CSSProperty');
13-
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
14-
1512
var dangerousStyleValue = require('dangerousStyleValue');
1613

1714
if (__DEV__) {
1815
var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
1916
var warnValidStyle = require('warnValidStyle');
2017
}
2118

22-
var hasShorthandPropertyBug = false;
23-
if (ExecutionEnvironment.canUseDOM) {
24-
var tempStyle = document.createElement('div').style;
25-
try {
26-
// IE8 throws "Invalid argument." if resetting shorthand style properties.
27-
tempStyle.font = '';
28-
} catch (e) {
29-
hasShorthandPropertyBug = true;
30-
}
31-
}
32-
3319
/**
3420
* Operations for dealing with CSS properties.
3521
*/
@@ -98,18 +84,7 @@ var CSSPropertyOperations = {
9884
} else if (styleValue) {
9985
style[styleName] = styleValue;
10086
} else {
101-
var expansion =
102-
hasShorthandPropertyBug &&
103-
CSSProperty.shorthandPropertyExpansions[styleName];
104-
if (expansion) {
105-
// Shorthand property that IE8 won't like unsetting, so unset each
106-
// component to placate it
107-
for (var individualStyleName in expansion) {
108-
style[individualStyleName] = '';
109-
}
110-
} else {
111-
style[styleName] = '';
112-
}
87+
style[styleName] = '';
11388
}
11489
}
11590
},

0 commit comments

Comments
 (0)