diff --git a/src/renderers/dom/client/utils/setTextContent.js b/src/renderers/dom/client/utils/setTextContent.js index e85d863d623e1..03adef5d60cec 100644 --- a/src/renderers/dom/client/utils/setTextContent.js +++ b/src/renderers/dom/client/utils/setTextContent.js @@ -28,7 +28,7 @@ var setInnerHTML = require('setInnerHTML'); var setTextContent = function(node, text) { if (text) { var firstChild = node.firstChild; - + if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { firstChild.nodeValue = text; return; @@ -40,6 +40,10 @@ var setTextContent = function(node, text) { if (ExecutionEnvironment.canUseDOM) { if (!('textContent' in document.documentElement)) { setTextContent = function(node, text) { + if (node.nodeType === 3) { + node.nodeValue = text; + return; + } setInnerHTML(node, escapeTextContentForBrowser(text)); }; }