self
is defined by the javascript environment and points to the [global] object (but is not part of the spec, so might not be there), while window
is part of the DOM specification.
In most browsers the window
is used as the [global] object, but this is not always so.
That self == window.self
is not strange as they are the same object - when self
is being looked up, it is found as a property of the global object (window
). So it is in fact the same as window.self == window.self
.
As noted elsewhere, to reliable reference the [global]
object, you should define it your sef by running var global = this;
in the global execution context.