Generate HTML and get reference to element : DOMParser + querySelectorAll vs document.createElement (version: 1)
We want to build HTMLElements and get reference to some of them in an object named controller. Here we say we want reference to elements with an 'id'.<br>
<br>
We test two different methods :<br>
- Create elements from HTML string using DOMParser and use querySelectorAll to build controller<br>
- Create elements from createElement method and build controller from them<br>
<br>
Here we also put the generated DOM in a fragment because we want to be able to append generated DOM to any element
Comparing performance of: DOMParser + querySelectorAll vs document.createElement
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory