mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
prevent removing attributes on custom component tags (#12702)
This commit is contained in:
@@ -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
packages/react-dom/src/shared/DOMProperty.js
vendored
3
packages/react-dom/src/shared/DOMProperty.js
vendored
@@ -157,6 +157,9 @@ export function shouldRemoveAttribute(
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (isCustomComponentTag) {
|
||||
return false;
|
||||
}
|
||||
if (propertyInfo !== null) {
|
||||
switch (propertyInfo.type) {
|
||||
case BOOLEAN:
|
||||
|
||||
Reference in New Issue
Block a user