From a270e03bdf3ef57292f1666b5b5e89d5f3932132 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 29 Aug 2017 09:48:34 -0700 Subject: [PATCH] Ignore and warn about non-string `is` attribute --- .../dom/fiber/ReactDOMFiberComponent.js | 2 +- .../shared/__tests__/ReactDOMComponent-test.js | 14 +++++++++++++- .../shared/hooks/ReactDOMUnknownPropertyHook.js | 17 +++++++++++++++++ .../dom/shared/utils/isCustomComponent.js | 2 +- .../dom/stack/client/ReactDOMComponent.js | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/renderers/dom/fiber/ReactDOMFiberComponent.js b/src/renderers/dom/fiber/ReactDOMFiberComponent.js index fd10cf0e99995..b1a7bc1919f86 100644 --- a/src/renderers/dom/fiber/ReactDOMFiberComponent.js +++ b/src/renderers/dom/fiber/ReactDOMFiberComponent.js @@ -326,7 +326,7 @@ var ReactDOMFiberComponent = { // This is guaranteed to yield a script element. var firstChild = ((div.firstChild: any): HTMLScriptElement); domElement = div.removeChild(firstChild); - } else if (props.is) { + } else if (typeof props.is === 'string') { // $FlowIssue `createElement` should be updated for Web Components domElement = ownerDocument.createElement(type, {is: props.is}); } else { diff --git a/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js b/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js index 050c31317b5e0..13f1fd2e00ba5 100644 --- a/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js +++ b/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js @@ -635,12 +635,24 @@ describe('ReactDOMComponent', () => { expect(nodeValueSetter.mock.calls.length).toBe(3); }); - it('should ignore attribute whitelist for elements with the "is: attribute', () => { + it('should ignore attribute whitelist for elements with the "is" attribute', () => { var container = document.createElement('div'); ReactDOM.render(