In just about every example I come across for injecting a script dynamically with javascript, it ends with:
document.getElementsByTagName("head")[0].appendChild(theNewScriptTag)
Even yepnope.js attaches new scripts before the first script in the page, like:
var firstScript = doc.getElementsByTagName( "script" )[ 0 ];
firstScript.parentNode.insertBefore( theNewScriptTag, firstScript );
My question is: why not just append it to the document body?
document.body.appendChild(theNewScriptTag);
It just seems to me that the DOM-traversal involved with getElementsByTagName
-- or even the whole "insertAfter = parent.insertBefore" trick -- is wasting resources.
Is there a detriment to dynamically adding your scripts to the very bottom?