@samitouri / QOS-React-2 / commits / 7eb33ef176

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

Cheng Lou committed Feb 20, 2014 at 15:59 UTC 7eb33ef176a458679b032f40540ae466a8a03efe
1 file changed +1 -15
src/browser/ReactComponentBrowserEnvironment.js
+1 -15
@@ -133,21 +133,7 @@ var ReactComponentBrowserEnvironment = {
133 'See renderComponentToString() for server rendering.'
134 );
135
136 - // Asynchronously inject markup by ensuring that the container is not in
137 - // the document when settings its `innerHTML`.
138 - var parent = container.parentNode;
139 - if (parent) {
140 - var next = container.nextSibling;
141 - parent.removeChild(container);
142 - container.innerHTML = markup;
143 - if (next) {
144 - parent.insertBefore(container, next);
145 - } else {
146 - parent.appendChild(container);
147 - }
148 - } else {
149 - container.innerHTML = markup;
150 - }
136 + container.innerHTML = markup;
137 }
138 )
139 };