David Mark wrote:
> On Feb 8, 7:49 pm, Garrett Smith <dhtmlkitc...@gmail.com> wrote:
>> 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.
>
> Will you please put that Kool-aid down? You don't need such cleanup
> if you avoid the circular references we have discussed here ad
> nauseam.
>
No worries, kid: I spare the Kool aid for girls like you. It's either
protein shakes, tea, or coffee.
>> 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.
>
> No mystery. They are host objects, so they can do whatever they want.
>
Sure thing, they're host objects.
I'm trying to figure out this behavior in a particular case. You don't
seem to have the answer.
> You should change your design so that you do not have to differentiate
> between windows and documents.
Were you making comments about code you haven't read? Or is it about the
strategy mentioned in the (my) first paragraph of the OP?
--
Garrett
comp.lang.javascript FAQ:
http://jibbering.com/faq/