Under what conditions is the Parse HTML code called?

I am trying to debug a bottleneck in my rendering of an HTML page with multiple backbone views. I used the Timeline Tim Tools profiler and saw a large number of Parse HTML events. My question is:

Does this necessarily mean that the DOM has been affected every time, or does this HTML Parse event also fire when manipulating HTML in a separate jquery object?

+4
source share
1 answer

Disclaimer: I do not know anything about the database, except that it is a framework.

This may mean that the DOM has been affected every time, but this is optional. Obviously, when loading an HTML document, you will trigger parsing events, as well as when you play with one of these interfaces innerHTML , outerHTML , innerText insertAdjacentHTML , DOMParser , but these are just the tip of the iceberg. Many things will trigger parsing of HTML events.

For instance:

 setInterval(function(){ var parser = new DOMParser(); parser.parseFromString('<p>lorem</p>','text/html'); },5000); 

This will trigger HTML parsing every 5 seconds, but it will not touch the DOM . But when you use, for example, document.body.innerHTML = '<p>Hello</p>' you activate event parsing, and also click DOM . This way you can have parsing events even if you are not directly touching the DOM directly.

+2
source

All Articles