h5bp/movethewebforward — Issue #31: Minor js things
Author: jdalton
Created: 2011-11-30 18:01:25+00:00
State: open

I was browsing the js and noticed in `controler.js`

~~~ js
head = doc.head || doc.getElementsByTagName( "head" )[0] || docElem
~~~

is more weight than

~~~ js
head = doc.getElementsByTagName( "head" )[0] || docElem
~~~

for something that's executing once and being stored in a var it seems silly to html5 fork it.

Also curious about

~~~
//might need to wait until DOMReady in IE...
if( lastlink.nextSibling ){
head.insertBefore(lk, lastlink.nextSibling );
} else {
head.appendChild( lk );
}
~~~

I'm not sure of the `lastlink.nextSibling` check, is order really important?
Can't it all be done via the `head.insertBefore(lk, lastlink.nextSibling );` without forking for `appendChild`?