diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index b064540a8ddf5..2911099e8e932 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -1221,7 +1221,7 @@ describe('ReactDOMComponent', () => { } }); - it('should not duplicate uppercased selfclosing tags', () => { + it('should warn for uppercased selfclosing tags', () => { class Container extends React.Component { render() { return React.createElement('BR', null); @@ -1237,7 +1237,8 @@ describe('ReactDOMComponent', () => { 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', ); - expect(returnedValue).not.toContain('
'); + // This includes a duplicate tag because we didn't treat this as self-closing. + expect(returnedValue).toContain('
'); }); it('should warn on upper case HTML tags, not SVG nor custom tags', () => { diff --git a/packages/react-dom/src/server/ReactPartialRenderer.js b/packages/react-dom/src/server/ReactPartialRenderer.js index 1e536e5cdd496..92cd79fde30c0 100644 --- a/packages/react-dom/src/server/ReactPartialRenderer.js +++ b/packages/react-dom/src/server/ReactPartialRenderer.js @@ -1324,7 +1324,7 @@ class ReactDOMServerRenderer { context: Object, parentNamespace: string, ): string { - const tag = element.type.toLowerCase(); + const tag = element.type; let namespace = parentNamespace; if (parentNamespace === HTML_NAMESPACE) { @@ -1335,7 +1335,7 @@ class ReactDOMServerRenderer { if (namespace === HTML_NAMESPACE) { // Should this check be gated by parent namespace? Not sure we want to // allow or . - if (tag !== element.type) { + if (tag.toLowerCase() !== element.type) { console.error( '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' +