Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove IE8 property expansion workaround #10803

Merged
merged 2 commits into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions src/renderers/dom/shared/CSSProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,71 +84,8 @@ Object.keys(isUnitlessNumber).forEach(function(prop) {
});
});

/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true,
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true,
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true,
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true,
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true,
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true,
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true,
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true,
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true,
},
};

var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions,
};

module.exports = CSSProperty;
27 changes: 1 addition & 26 deletions src/renderers/dom/shared/CSSPropertyOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,13 @@

'use strict';

var CSSProperty = require('CSSProperty');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');

var dangerousStyleValue = require('dangerousStyleValue');

if (__DEV__) {
var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
var warnValidStyle = require('warnValidStyle');
}

var hasShorthandPropertyBug = false;
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
}

/**
* Operations for dealing with CSS properties.
*/
Expand Down Expand Up @@ -100,18 +86,7 @@ var CSSPropertyOperations = {
} else if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion =
hasShorthandPropertyBug &&
CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
style[styleName] = '';
}
}
},
Expand Down