Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions fixtures/ssr/src/components/Chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export default class Chrome extends Component {
<title>{this.props.title}</title>
</head>
<body>
<noscript
dangerouslySetInnerHTML={{
__html: `<b>Enable JavaScript to run this app.</b>`,
}}
/>
{this.props.children}
<script
dangerouslySetInnerHTML={{
Expand Down
13 changes: 6 additions & 7 deletions src/renderers/dom/fiber/ReactDOMFiberComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,16 @@ if (__DEV__) {
);
};

var testDocument;
// Parse the HTML and read it back to normalize the HTML string so that it
// can be used for comparison.
var normalizeHTML = function(parent: Element, html: string) {
if (!testDocument) {
// The title argument is required in IE11 so we pass an empty string.
testDocument = document.implementation.createHTMLDocument('');
}
// We could have created a separate document here to avoid
// re-initializing custom elements if they exist. But this breaks
// how <noscript> is being handled. So we use the same document.
// See the discussion in https://github.com/facebook/react/pull/11157.
var testElement = parent.namespaceURI === HTML_NAMESPACE
? testDocument.createElement(parent.tagName)
: testDocument.createElementNS(
? parent.ownerDocument.createElement(parent.tagName)
: parent.ownerDocument.createElementNS(
(parent.namespaceURI: any),
parent.tagName,
);
Expand Down