This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Specification: http://www.whatwg.org/specs/web-apps/current-work/ Multipage: http://www.whatwg.org/C#named-access-on-the-window-object Complete: http://www.whatwg.org/c#named-access-on-the-window-object Referrer: Comment: Is the ability to access elements by their name or ID likely to be removed? Should their be a note that discourages its use? Everything I read on the Internet, discourages this practice, as they are all HOPING this features/bug gets removed. I have found it quite useful as a teaching tool. I teach coding via CodeAvengers.com and it is quite nice not to have to ram document.getElementById() down learners through from the get go. Posted from: 125.239.230.240 User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1962.0 Safari/537.36
I doubt this will change. It's bad practice for many reasons, but we're more or less stuck with it, I think. bz might have an opinion about this.
I tried to convince non-Gecko UAs to remove this, and failed. So I doubt it's going to go anywhere. That said, it's a really bad habit to get into, because it's very unreliable. Whether the element is accessible by window.id depends on the value of the id, and an element that's accessible today might not be tomorrow if a new function with the same name gets added to the window...
Yeah.
So the request here would be to turn the very very vague author advice here: http://whatwg.org/html#named-access-on-the-window-object ...into something much more opinionated, I guess.
Checked in as WHATWG revision r8631. Check-in comment: Discourage window.foo usage http://html5.org/tools/web-apps-tracker?from=8630&to=8631
Ok, is that enough?
Marking FIXED based on the diff in comment 5 and the lack of complaints thereon. If you want more, just reopen the bug. Thanks!