I am trying to debug a bottleneck in my rendering of an HTML page with multiple backbone views. I used Chrome Dev Tools's Timeline profiler and saw a big amount of Parse HTML events. My question is:
Does this necessarily mean the DOM was touched each time, or is the Parse HTML event also triggered when manipulating HTML in a detached jquery object?
Disclaimer: I don't know anything about backbone except that it is a framework.
It can mean that the DOM was touched each time but it does not need necessarily. You will trigger parsing events obviously when you are loading HTML document and also when you are playing with one of these innerHTML
, outerHTML
, innerText
insertAdjacentHTML
, DOMParser
interface but these are just tip of the iceberg. A lot of stuff will trigger parse HTML events.
For example:
setInterval(function(){
var parser = new DOMParser();
parser.parseFromString('<p>lorem</p>','text/html');
},5000);
This will trigger HTML parser every 5 seconds but it will not touch DOM.
But when you use for example document.body.innerHTML = '<p>Hello</p>'
you will trigger parsing events as well touch the DOM.
So you can have parse events even if you are not directly touching the DOM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With