mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #3410 from robertknight/3409-style-null-to-nonnull
Fix incorrect update of style when props.style transitions from null to non-null
(cherry picked from commit bcd70ad500)
This commit is contained in:
committed by
Paul O’Shannessy
parent
cfbf1d559f
commit
6cc7567eff
@@ -350,6 +350,7 @@ ReactDOMComponent.Mixin = {
|
||||
styleUpdates[styleName] = '';
|
||||
}
|
||||
}
|
||||
this._previousStyleCopy = null;
|
||||
} else if (registrationNameModules.hasOwnProperty(propKey)) {
|
||||
deleteListener(this._rootNodeID, propKey);
|
||||
} else if (
|
||||
|
||||
@@ -152,6 +152,17 @@ describe('ReactDOMComponent', function() {
|
||||
expect(stubStyle.color).toEqual('');
|
||||
});
|
||||
|
||||
it("should update styles when 'style' changes from null to object", function() {
|
||||
var container = document.createElement('div');
|
||||
var styles = {color: 'red'};
|
||||
React.render(<div style={styles} />, container);
|
||||
React.render(<div />, container);
|
||||
React.render(<div style={styles} />, container);
|
||||
|
||||
var stubStyle = container.firstChild.style;
|
||||
expect(stubStyle.color).toEqual('red');
|
||||
});
|
||||
|
||||
it("should empty element when removing innerHTML", function() {
|
||||
var container = document.createElement('div');
|
||||
React.render(<div dangerouslySetInnerHTML={{__html: ':)'}} />, container);
|
||||
|
||||
Reference in New Issue
Block a user