From 7eb33ef176a458679b032f40540ae466a8a03efe Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 20 Feb 2014 15:59:05 -0800 Subject: [PATCH] simplify `mountImageIntoNode`'s way of putting markup in innerHTML Instead of removing the node from the document before changing its innerHTML, just do it directly. The comment seems to be outdated for years. http://jsperf.com/detach-while-setting-innerhtml --- src/browser/ReactComponentBrowserEnvironment.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/browser/ReactComponentBrowserEnvironment.js b/src/browser/ReactComponentBrowserEnvironment.js index 570e61dea2..0f6c307752 100644 --- a/src/browser/ReactComponentBrowserEnvironment.js +++ b/src/browser/ReactComponentBrowserEnvironment.js @@ -133,21 +133,7 @@ var ReactComponentBrowserEnvironment = { 'See renderComponentToString() for server rendering.' ); - // Asynchronously inject markup by ensuring that the container is not in - // the document when settings its `innerHTML`. - var parent = container.parentNode; - if (parent) { - var next = container.nextSibling; - parent.removeChild(container); - container.innerHTML = markup; - if (next) { - parent.insertBefore(container, next); - } else { - parent.appendChild(container); - } - } else { - container.innerHTML = markup; - } + container.innerHTML = markup; } ) };