From 233195cb6bc632ade61a8f64569b4d94061860d6 Mon Sep 17 00:00:00 2001 From: Joel Denning Date: Wed, 19 Apr 2017 05:07:16 -0600 Subject: [PATCH] Fixing the instantiation of customized builtin elements (related to custom elements) (#9313) * Fixing the creation of customized builtin elements * Whitespace * Running prettier * Updating ReactDOMFiberComponent --- src/renderers/dom/fiber/ReactDOMFiberComponent.js | 2 +- .../dom/shared/__tests__/ReactDOMComponent-test.js | 7 +++---- src/renderers/dom/stack/client/ReactDOMComponent.js | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/renderers/dom/fiber/ReactDOMFiberComponent.js b/src/renderers/dom/fiber/ReactDOMFiberComponent.js index 7718b4e89ca9b..31430af92ee2c 100644 --- a/src/renderers/dom/fiber/ReactDOMFiberComponent.js +++ b/src/renderers/dom/fiber/ReactDOMFiberComponent.js @@ -439,7 +439,7 @@ var ReactDOMFiberComponent = { var firstChild = ((div.firstChild: any): HTMLScriptElement); domElement = div.removeChild(firstChild); } else if (props.is) { - domElement = ownerDocument.createElement(type, props.is); + domElement = ownerDocument.createElement(type, {is: props.is}); } else { // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. // See discussion in https://github.com/facebook/react/pull/6896 diff --git a/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js b/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js index ca2ec1cf0079b..99bf0780925e2 100644 --- a/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js +++ b/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js @@ -1071,10 +1071,9 @@ describe('ReactDOMComponent', () => { var container = document.createElement('div'); spyOn(document, 'createElement').and.callThrough(); ReactDOM.render(
, container); - expect(document.createElement).toHaveBeenCalledWith( - 'div', - 'custom-div', - ); + expect(document.createElement).toHaveBeenCalledWith('div', { + is: 'custom-div', + }); } else { expect( ReactDOMServer.renderToString(
), diff --git a/src/renderers/dom/stack/client/ReactDOMComponent.js b/src/renderers/dom/stack/client/ReactDOMComponent.js index 8b2e144e9c24a..91d84e906133b 100644 --- a/src/renderers/dom/stack/client/ReactDOMComponent.js +++ b/src/renderers/dom/stack/client/ReactDOMComponent.js @@ -552,7 +552,7 @@ ReactDOMComponent.Mixin = { div.innerHTML = `<${type}>`; el = div.removeChild(div.firstChild); } else if (props.is) { - el = ownerDocument.createElement(type, props.is); + el = ownerDocument.createElement(type, {is: props.is}); } else { // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. // See discussion in https://github.com/facebook/react/pull/6896