Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -1237,7 +1237,8 @@ describe('ReactDOMComponent', () => {
'Use PascalCase for React components, ' +
'or lowercase for HTML elements.',
);
expect(returnedValue).not.toContain('</BR>');
// This includes a duplicate tag because we didn't treat this as self-closing.
expect(returnedValue).toContain('</BR>');
});

it('should warn on upper case HTML tags, not SVG nor custom tags', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactPartialRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -1335,7 +1335,7 @@ class ReactDOMServerRenderer {
if (namespace === HTML_NAMESPACE) {
// Should this check be gated by parent namespace? Not sure we want to
// allow <SVG> or <mATH>.
if (tag !== element.type) {
if (tag.toLowerCase() !== element.type) {
console.error(
'<%s /> is using incorrect casing. ' +
'Use PascalCase for React components, ' +
Expand Down