Skip to content

Commit

Permalink
prevent removing attributes on custom component tags (#12702)
Browse files Browse the repository at this point in the history
  • Loading branch information
airamrguez authored and gaearon committed Apr 28, 2018
1 parent 045d4f1 commit dcc854b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});
3 changes: 3 additions & 0 deletions packages/react-dom/src/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ export function shouldRemoveAttribute(
) {
return true;
}
if (isCustomComponentTag) {
return false;
}
if (propertyInfo !== null) {
switch (propertyInfo.type) {
case BOOLEAN:
Expand Down

0 comments on commit dcc854b

Please sign in to comment.