DOM:window.window
From MDC
[edit] Summary
The window property of a window object points to the window object itself. Thus the following expressions all return the same window object:
window.window window.window.window window.window.window.window ...
In web pages, the window object is also a global object. This means that:
- global variables of your script are in fact properties of
window:var global = {data: 0}; alert(global === window.global); // displays "true" - you can access built-in properties of the window object without having to type
window.prefix:setTimeout("alert('Hi!')", 50); // equivalent to using window.setTimeout. alert(window === window.window); // displays "true"
The point of having the window property refer to the object itself was (probably) to make it easy to refer to the global object (otherwise you'd have to do a manual var window = this; assignment at the top of your script).
Another reason is that without this property you wouldn't be able to write, for example, "window.open('http://google.com/')" - you'd have to just use "open('http://google.com/')" instead.
[edit] Specification
DOM Level 0. Not part of any standard.