mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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
This commit is contained in:
committed by
Paul O’Shannessy
parent
5545887a48
commit
7eb33ef176
@@ -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;
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user