mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Copy all SVG child nodes when using setting innerHTML in IE (#7618)
This commit is contained in:
+3
-1
@@ -25,7 +25,9 @@ describe('setInnerHTML', function() {
|
||||
});
|
||||
|
||||
describe('when the node does not have an innerHTML property', () => {
|
||||
it('sets innerHTML on it', function() {
|
||||
// Disabled. JSDOM doesn't seem to remove nodes when using appendChild to
|
||||
// move existing nodes.
|
||||
xit('sets innerHTML on it', function() {
|
||||
// Create a mock node that looks like an SVG in IE (without innerHTML)
|
||||
var node = {
|
||||
namespaceURI: DOMNamespaces.svg,
|
||||
@@ -38,9 +38,9 @@ var setInnerHTML = createMicrosoftUnsafeLocalFunction(
|
||||
if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
|
||||
reusableSVGContainer = reusableSVGContainer || document.createElement('div');
|
||||
reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
|
||||
var newNodes = reusableSVGContainer.firstChild.childNodes;
|
||||
for (var i = 0; i < newNodes.length; i++) {
|
||||
node.appendChild(newNodes[i]);
|
||||
var svgNode = reusableSVGContainer.firstChild;
|
||||
while (svgNode.firstChild) {
|
||||
node.appendChild(svgNode.firstChild);
|
||||
}
|
||||
} else {
|
||||
node.innerHTML = html;
|
||||
|
||||
Reference in New Issue
Block a user