This is hilarious:
A co-worker noticed something strange happening in his Chrome browser:
Every element in an HTML page that has an
id attribute gets attached
as a member of the global
I checked and it happens in my Safari as well. A bit of googling led us to the answer at StackOverflow:
What is supposed to happen is that ‘named elements’ are added as apparent properties of the
documentobject. This is a really bad idea, as it allows element names to clash with real properties of
IE made the situation worse by also adding named elements as properties of the
windowobject. This is doubly bad in that now you have to avoid naming your elements after any member of either the
windowobject you (or any other library code in your project) might want to use.
Opera copied IE, then WebKit joined in, and now both the previously-unstandardised practice of putting named elements on
documentproperties, and the previously-IE-only practice of putting them on
windoware being standardised by HTML5, whose approach is to document and standardise every terrible practice inflicted on us by browser authors, making them part of the web forever. So Firefox 4 will also support this.
This is such a funny turn of events. And a great metaphor for how these inner decisions are made in browser politics.