Skip to content

Commit

Permalink
Fixed bug with updating TextNode in IE8 (facebook#7824)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnpenner committed Sep 28, 2016
1 parent 87724bd commit e8cfdce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/renderers/dom/client/utils/__tests__/setInnerHTML-test.js
Expand Up @@ -40,5 +40,13 @@ describe('setInnerHTML', () => {
expect(node.appendChild.calls.argsFor(0)[0].outerHTML).toBe('<circle></circle>');
expect(node.appendChild.calls.argsFor(1)[0].outerHTML).toBe('<rect></rect>');
});

xit('sets nodeValue on it', () => {
// Disabled. Works when "if (testElement.innerHTML === '') {" is changed to "if (true) {" to emulate IE8.
var node = document.createTextNode('foo');
var text = 'bar';
setInnerHTML(node, text);
expect(node.nodeValue).toBe(text);
})
});
});
2 changes: 2 additions & 0 deletions src/renderers/dom/client/utils/setInnerHTML.js
Expand Up @@ -90,6 +90,8 @@ if (ExecutionEnvironment.canUseDOM) {
} else {
textNode.deleteData(0, 1);
}
} else if (node.nodeType === 3/* Text */) {
node.nodeValue = html;
} else {
node.innerHTML = html;
}
Expand Down

0 comments on commit e8cfdce

Please sign in to comment.