I've noticed this a really long time ago, but I never found any information as to why this is supported by browsers in the first place.
In every major browser, it is possible to refer to elements on the page by using their id as a global variable. This fiddle shows an example of how it works. You can also try this out yourself (on this page) by just opening your console and pasting footer
in it (which will return the <div id="footer">
on this page), or if you want to try it on a browser without console, just run javascript:alert(footer)
from your url bar, which should alert "[object HTMLDivElement]" or something similar.
I've tested this in Chrome, Firefox, Opera and even Internet Explorer, and in each of those browsers it seems to work. After searching for any standards about it though, I couldn't find anything.
My question is, why does this work in every single browser, and is this part of any standards? Or is this just core JavaScript?