@samitouri / QOS-React-2 / commits / 2566b2420b

Remove IE8 property expansion workaround (#10803)

* Remove IE8 property expansion workaround * Edit from a plane ✈️

Dan Abramov committed Sep 27, 2017 at 12:59 UTC 2566b2420b714c00b3a456b8d744a26387eaf511
2 files changed +1 -89
src/renderers/dom/shared/CSSProperty.js
-63
@@ -82,71 +82,8 @@ Object.keys(isUnitlessNumber).forEach(function(prop) {
82 });
83 });
84
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 -
85 var CSSProperty = {
86 isUnitlessNumber: isUnitlessNumber,
149 - shorthandPropertyExpansions: shorthandPropertyExpansions,
87 };
88
89 module.exports = CSSProperty;
src/renderers/dom/shared/CSSPropertyOperations.js
+1 -26
@@ -9,9 +9,6 @@
9
10 'use strict';
11
12 -var CSSProperty = require('CSSProperty');
13 -var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
14 -
12 var dangerousStyleValue = require('dangerousStyleValue');
13
14 if (__DEV__) {
@@ -19,17 +16,6 @@ if (__DEV__) {
16 var warnValidStyle = require('warnValidStyle');
17 }
18
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 -
19 /**
20 * Operations for dealing with CSS properties.
21 */
@@ -98,18 +84,7 @@ var CSSPropertyOperations = {
84 } else if (styleValue) {
85 style[styleName] = styleValue;
86 } 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] = '';
88 }
89 }
90 },