G
Garrett Smith
I'm confused about IE's evaluation of window == document.
IE:
window == document; // true
document == window; // false
I came across this while testing to see if an object is a window.
I need this so that in the registry cleanup for DOM events, that if the
object is window, then don't unregister callbacks. This works fine as
callbacks for window don't need cleanup, but it is also important as
removing unload callbacks before they fire will mean those callbacks
won't fire ever -- that's bad.
So I want to continue the loop if the object is window, but came across
this oddity. I am going to base my programming strategy around the
operands being in a certain side of == -- and I really don't like doing
that -- then at the very least I need a comment explaining why. I can't
explain it because I don't understand it. Somebody please fix that.
IE:
window == document; // true
document == window; // false
I came across this while testing to see if an object is a window.
I need this so that in the registry cleanup for DOM events, that if the
object is window, then don't unregister callbacks. This works fine as
callbacks for window don't need cleanup, but it is also important as
removing unload callbacks before they fire will mean those callbacks
won't fire ever -- that's bad.
So I want to continue the loop if the object is window, but came across
this oddity. I am going to base my programming strategy around the
operands being in a certain side of == -- and I really don't like doing
that -- then at the very least I need a comment explaining why. I can't
explain it because I don't understand it. Somebody please fix that.