Fixing the instantiation of customized builtin elements (related to custom elements) (#9313)
* Fixing the creation of customized builtin elements * Whitespace * Running prettier * Updating ReactDOMFiberComponent
Joel Denning committed
Apr 19, 2017 at 05:07 UTC
233195cb6bc632ade61a8f64569b4d94061860d6
3 files changed
+5
-6
src/renderers/dom/fiber/ReactDOMFiberComponent.js
+1
-1
@@ -439,7 +439,7 @@ var ReactDOMFiberComponent = {
439
var firstChild = ((div.firstChild: any): HTMLScriptElement);
440
domElement = div.removeChild(firstChild);
441
} else if (props.is) {
442
- domElement = ownerDocument.createElement(type, props.is);
442
+ domElement = ownerDocument.createElement(type, {is: props.is});
443
} else {
444
// Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
445
// See discussion in https://github.com/facebook/react/pull/6896
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+3
-4
@@ -1071,10 +1071,9 @@ describe('ReactDOMComponent', () => {
1071
var container = document.createElement('div');
1072
spyOn(document, 'createElement').and.callThrough();
1073
ReactDOM.render(<div is="custom-div" />, container);
1074
- expect(document.createElement).toHaveBeenCalledWith(
1075
- 'div',
1076
- 'custom-div',
1077
- );
1074
+ expect(document.createElement).toHaveBeenCalledWith('div', {
1075
+ is: 'custom-div',
1076
+ });
1077
} else {
1078
expect(
1079
ReactDOMServer.renderToString(<div is="custom-div" />),
src/renderers/dom/stack/client/ReactDOMComponent.js
+1
-1
@@ -552,7 +552,7 @@ ReactDOMComponent.Mixin = {
552
div.innerHTML = `<${type}></${type}>`;
553
el = div.removeChild(div.firstChild);
554
} else if (props.is) {
555
- el = ownerDocument.createElement(type, props.is);
555
+ el = ownerDocument.createElement(type, {is: props.is});
556
} else {
557
// Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
558
// See discussion in https://github.com/facebook/react/pull/6896