diff --git a/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js b/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js index aabb3e995f864..08874222d594c 100644 --- a/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js +++ b/packages/react-dom/src/__tests__/DOMPropertyOperations-test.js @@ -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(, container); + expect(container.firstChild.getAttribute('size')).toBe('5px'); + }); }); }); diff --git a/packages/react-dom/src/shared/DOMProperty.js b/packages/react-dom/src/shared/DOMProperty.js index dd2c8f6e3a429..b01c069dbad0c 100644 --- a/packages/react-dom/src/shared/DOMProperty.js +++ b/packages/react-dom/src/shared/DOMProperty.js @@ -157,6 +157,9 @@ export function shouldRemoveAttribute( ) { return true; } + if (isCustomComponentTag) { + return false; + } if (propertyInfo !== null) { switch (propertyInfo.type) { case BOOLEAN: