prevent removing attributes on custom component tags (#12702)

This commit is contained in:
Airam
2018-04-28 21:52:30 +02:00
committed by Dan Abramov
parent 045d4f166d
commit dcc854bcc3
2 changed files with 9 additions and 0 deletions

View File

@@ -155,5 +155,11 @@ describe('DOMPropertyOperations', () => {
expect(container.firstChild.getAttribute('value')).toBe('foo');
expect(container.firstChild.value).toBe('foo');
});
it('should not remove attributes for custom component tag', () => {
const container = document.createElement('div');
ReactDOM.render(<my-icon size="5px" />, container);
expect(container.firstChild.getAttribute('size')).toBe('5px');
});
});
});

View File

@@ -157,6 +157,9 @@ export function shouldRemoveAttribute(
) {
return true;
}
if (isCustomComponentTag) {
return false;
}
if (propertyInfo !== null) {
switch (propertyInfo.type) {
case BOOLEAN: