Skip to content

The IE11 document.implementation.createHTMLDocument API requires the title argument to be specified #10865

@leidegre

Description

@leidegre

Do you want to request a feature or report a bug?

bug

What is the current behavior?

React interactivity lost, React crash?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/ebsrpraL/).

Run with react-dom.development.js in IE11, not sure exactly what the exact repo steps are the fix I've attempted for IE11 was to simply pass an empty string.

var normalizeHTML = function (parent, html) {
    if (!testDocument) {
      testDocument = document.implementation.createHTMLDocument(""); // fix for IE11 here
    }
    var testElement = parent.namespaceURI === HTML_NAMESPACE ? testDocument.createElement(parent.tagName) : testDocument.createElementNS(parent.namespaceURI, parent.tagName);
    testElement.innerHTML = html;
    return testElement.innerHTML;
  };
}

Source

var normalizeHTML = function(parent: Element, html: string) {
if (!testDocument) {
testDocument = document.implementation.createHTMLDocument();
}
var testElement = parent.namespaceURI === HTML_NAMESPACE
? testDocument.createElement(parent.tagName)
: testDocument.createElementNS(
(parent.namespaceURI: any),
parent.tagName,
);
testElement.innerHTML = html;
return testElement.innerHTML;
};
}

MDN docs here.

What is the expected behavior?

Well, that React does not crash in dev mode and that interactively continues to work.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

react@16.0.0 IE11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions