Fixing the instantiation of customized builtin elements (related to custom elements) (#9313)

* Fixing the creation of customized builtin elements

* Whitespace

* Running prettier

* Updating ReactDOMFiberComponent
This commit is contained in:
Joel Denning
2017-04-19 12:07:16 +01:00
committed by Dan Abramov
parent ff7baa4c95
commit d3f84edcb6
3 changed files with 5 additions and 6 deletions
@@ -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
@@ -1071,10 +1071,9 @@ describe('ReactDOMComponent', () => {
var container = document.createElement('div');
spyOn(document, 'createElement').and.callThrough();
ReactDOM.render(<div is="custom-div" />, container);
expect(document.createElement).toHaveBeenCalledWith(
'div',
'custom-div',
);
expect(document.createElement).toHaveBeenCalledWith('div', {
is: 'custom-div',
});
} else {
expect(
ReactDOMServer.renderToString(<div is="custom-div" />),
@@ -552,7 +552,7 @@ ReactDOMComponent.Mixin = {
div.innerHTML = `<${type}></${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