[GopherJS] Get head Element in HTML Document


Access head element in HTML document via getElementsByTagName and GopherJS:

head := js.Global.Get("document").Call("getElementsByTagName", "head").Call("item", 0)

equivalent to the following JavaScript code:

var head = document.getElementsByTagName("head")[0];

Tested on: Ubuntu Linux 15.10, Go 1.6.


References:

[1]GopherJS - A compiler from Go to JavaScript (GitHub, GopherJS Playground, godoc)
[2]javascript - document.head v. document.getElementsByTagName("head")[0] - Stack Overflow
[3]Element.getElementsByTagName() - Web APIs | MDN
[4]HTMLCollection - Web APIs | MDN