Is there any consideration that should be done between using the head or the body to add template tags? Ex:
conste template = document.createElement('template');
// add template content etc.
document.body.appendChild(template);
// or
document.head.appendChild(template);
I just stumble upon a code base that dynamically adds templates to head
and my gut tells me that maybe it isn't the best idea, but maybe it doesn't matter?
Templates are among the most flexible of all the elements in where they can be placed. The spec says
"Where metadata content is expected." essentially means in the head.
"Where phrasing content is expected." essentially means anywhere the valid child of a body element can go.
"Where script-supporting elements are expected" means it can go even in places that phrasing content can't, such as the child of ul, ol, table, tbody, tr etc elements.