Skip to content

Commit 7eb33ef

Browse files
Cheng Louzpao
authored andcommitted
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
1 parent 5545887 commit 7eb33ef

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

src/browser/ReactComponentBrowserEnvironment.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,7 @@ var ReactComponentBrowserEnvironment = {
133133
'See renderComponentToString() for server rendering.'
134134
);
135135

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;
151137
}
152138
)
153139
};

0 commit comments

Comments
 (0)