ian at hixie.ch
Mon Oct 5 16:28:28 PDT 2009
On Sun, 20 Sep 2009, Joseph Pecoraro wrote:
> 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.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg