mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
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:
committed by
Dan Abramov
parent
ff7baa4c95
commit
d3f84edcb6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user