Skip to content

Commit f41756a

Browse files
sebmarkbageacdlite
authored andcommitted
Don't lower case HTML tags in comparison for built-ins (facebook#21155)
1 parent 54e5bed commit f41756a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/react-dom/src/__tests__/ReactDOMComponent-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ describe('ReactDOMComponent', () => {
12211221
}
12221222
});
12231223

1224-
it('should not duplicate uppercased selfclosing tags', () => {
1224+
it('should warn for uppercased selfclosing tags', () => {
12251225
class Container extends React.Component {
12261226
render() {
12271227
return React.createElement('BR', null);
@@ -1237,7 +1237,8 @@ describe('ReactDOMComponent', () => {
12371237
'Use PascalCase for React components, ' +
12381238
'or lowercase for HTML elements.',
12391239
);
1240-
expect(returnedValue).not.toContain('</BR>');
1240+
// This includes a duplicate tag because we didn't treat this as self-closing.
1241+
expect(returnedValue).toContain('</BR>');
12411242
});
12421243

12431244
it('should warn on upper case HTML tags, not SVG nor custom tags', () => {

packages/react-dom/src/server/ReactPartialRenderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ class ReactDOMServerRenderer {
13241324
context: Object,
13251325
parentNamespace: string,
13261326
): string {
1327-
const tag = element.type.toLowerCase();
1327+
const tag = element.type;
13281328

13291329
let namespace = parentNamespace;
13301330
if (parentNamespace === HTML_NAMESPACE) {
@@ -1335,7 +1335,7 @@ class ReactDOMServerRenderer {
13351335
if (namespace === HTML_NAMESPACE) {
13361336
// Should this check be gated by parent namespace? Not sure we want to
13371337
// allow <SVG> or <mATH>.
1338-
if (tag !== element.type) {
1338+
if (tag.toLowerCase() !== element.type) {
13391339
console.error(
13401340
'<%s /> is using incorrect casing. ' +
13411341
'Use PascalCase for React components, ' +

0 commit comments

Comments
 (0)