IE Bug (window === top) === false

This isn’t exactly a bug: host objects can do whatever they like, and the window object is a particularly complicated beast, serving the dual purposes of being the object that represents the browser window and also being an alias for the global object. I’d chalk this one up as a weirdness and avoid using the strict === operator when comparing Window objects.

Note that this isn’t a “JavaScript is weird” shrugpost. As well as serving as the global object, window is a host object and pre-HTML5 could legitimately (according to spec, at least) behave however it liked. Older versions of IE take advantage of this freedom and exhibit much quirky behaviour for which there is no specification whatsoever. Trying to understand it all without access to the source code is a pointless exercise.

Leave a Comment