Coding is as much a matter of personal growth as it is of logic and control-flow. I keep patience, curiosity, & exuberance in the same toolbox as vim and git.
*Opinions posted are my own*
Online since 1990 Yes! I started with Gopher. I do modern Web Component Development with technologies supported by **all** WHATWG partners (Apple, Google, Microsoft & Mozilla)
Coding is as much a matter of personal growth as it is of logic and control-flow. I keep patience, curiosity, & exuberance in the same toolbox as vim and git.
*Opinions posted are my own*
Online since 1990 Yes! I started with Gopher. I do modern Web Component Development with technologies supported by **all** WHATWG partners (Apple, Google, Microsoft & Mozilla)
Shouldn't be innerHTMLing in constructor. Better to use the template
Can you motivate that statement, Benny
innerHTML
andappend(Child)
all do the same: they add content to a DOMThat
.createElement"template")
takes extra CPU cycles; content is parsed once.With
.innerHTML=
content is also parsed once.So there is only benefit if code does
template.cloneNode(true)
multiple timesif you know you're only going to use the element once, yeah there's no difference.
But if you're going to construct the element several times, then you're going to invoke the parser on each instance.
If the element's shadow DOM is extensive, that could add up fast.
Moreover, keeping the template static means it's parsed up front.
If you don't take my word; then maybe you take this guy his comment on
innerHTML
I don't know the guy personally .. but Justin Fagnani sounds familiar 😛