Skip to content

Commit

Permalink
Fix false positive SVG hydration warning for mixed case tags (#11174)
Browse files Browse the repository at this point in the history
* Add a failing test for <feMorphology> SSR

It causes a false positive warning on hydration.

* Make hydration tag comparison case insensitive
  • Loading branch information
gaearon authored Oct 10, 2017
1 parent 18f408f commit f42dfcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/renderers/dom/fiber/ReactDOMFiberEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ var DOMRenderer = ReactFiberReconciler({
): boolean {
return (
instance.nodeType === ELEMENT_NODE &&
type === instance.nodeName.toLowerCase()
type.toLowerCase() === instance.nodeName.toLowerCase()
);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,14 @@ describe('ReactDOMServerIntegration', () => {
},
);

itRenders('svg element with a mixed case name', async render => {
let e = await render(<svg><filter><feMorphology /></filter></svg>);
e = e.firstChild.firstChild;
expect(e.childNodes.length).toBe(0);
expect(e.tagName).toBe('feMorphology');
expect(e.namespaceURI).toBe('http://www.w3.org/2000/svg');
});

itRenders('a math element', async render => {
const e = await render(<math />);
expect(e.childNodes.length).toBe(0);
Expand Down

0 comments on commit f42dfcd

Please # to comment.