joepeck02 at gmail.com
Sun Sep 20 11:22:38 PDT 2009
Was there any discussion for including "document.head" in HTML5?
Searching the mailing list shows document.head show up a few times in
example code . However, there has been no proposal, and it is
not mentioned in the document's IDL  in the Spec.
Developers often do the following to get a reference to the <head>
element (top 2 google results) :
var head = document.getElementsByTagName('head');
Its useful for developers to use that reference to manipulate/append
stylesheets, scripts, and <style> elements which are only valid inside
the <head> when the scope attribute is absent .
I feel this would be useful to add. It is confusing that there is a
"document.body" but no "document.head". If added, code that interacts
with the <head> would be much clearer then the current popular
approach (shown above). Also, the current approach, barring
optimizations in the engine, could search the entire DOM tree.
More information about the whatwg