When generating dynamic content, which way is better to simply create the HTML and insert it into a .innerHTML or to create elements in the DOM directly?
I'm not concerned with complexity or other. Just processing time on the client.
Which is quicker?
If I had to guess in order of efficiency (low processing time) this would be:
- DOM Creation
- .innerHTML property insertion
- direct writing
This would be inversely related to the complexity of implmenting:
- direct writing
- .innerHTML property insertion
- DOM Creation
This is a validatin question? Can someone validate that this is the trade-offs for determining how to update the client (i.e. javascript) when considering complexity and speed?
Research:
I'm not concerned with security like they are here-> InnerHTML vs. DOM - Security
InnerHTML vs. DOM This is not a duplicate as it covers only part of my question.