mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Don't set innerHTML if content is empty (#8526)
From D4296244: > Each [...] had a component with innerHTML = '', causing us to go into HTML parsing code in the browser. Doing this takes 0.03ms per parse call which was 10x slower than skipping it.
This commit is contained in:
@@ -787,8 +787,9 @@ ReactDOMComponent.Mixin = {
|
||||
// Intentional use of != to avoid catching zero/false.
|
||||
var innerHTML = props.dangerouslySetInnerHTML;
|
||||
if (innerHTML != null) {
|
||||
if (innerHTML.__html != null) {
|
||||
DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
|
||||
const innerHTMLContent = innerHTML.__html;
|
||||
if (innerHTMLContent != null && innerHTMLContent !== '') {
|
||||
DOMLazyTree.queueHTML(lazyTree, innerHTMLContent);
|
||||
}
|
||||
} else {
|
||||
var contentToUse =
|
||||
|
||||
Reference in New Issue
Block a user