Windows Vista Tips

Windows Vista Tips > Newsgroups > Internet Explorer > Re: window == document

Reply
Thread Tools Display Modes

Re: window == document

 
 
Garrett Smith
Guest
Posts: n/a

 
      02-09-2010
Stefan Weiss wrote:
> On 09/02/10 01:49, Garrett Smith wrote:
>> I'm confused about IE's evaluation of window == document.
>>
>> IE:
>> window == document; // true
>> document == window; // false

>
> I may be missing something, but don't you want both of these to evalute
> to false? If so, Thomas's suggestion (using ===) should solve the
> problem. If you're dealing with some weird edge case, a comment should
> do it, IMHO. As if our code wasn't already riddled with "this is only
> for IE compatibility" comments ;-)
>

The problem with === is that window === window is not always true.

javascript: alert([window === window.window, window === self])

> I've never encountered this case, but I agree: it's definitely weird,
> non-standard behavior. I wish there was a way to talk to the IE
> developers, to ask them questions like this. With almost every other
> browser, you could just look at the source code and see what's going on,
> but IE is completely opaque. They don't even have a public bug tracker.


They do have a bug tracker (slow, when it works):
http://connect.microsoft.com/IE

I've filed bugs there myself.

Good bugs sometimes get marked as WONTFIX, INVALID, or Can't Reproduce.

The W3C Mailing Lists might seem like a way to talk to IE devs, but they
are a waste of time. The W3C is a pay-to-play organization arrogantly
out of control (put your money where your mouth is or STFU (or we'll ban
you permanently, lie about the reasons and lie and say it's only for two
weeks)).

My current test is based off using window on RHS. Given `a` and `b`, if
they are both the window, then
a == b.window; // true

If either `a` or `b` is `document`, then:
a == b.window; // false

In my code, there isn't any way `a` could be undefined because a
TypeError would prevent the object from being added to the registry:

a.addEventListener // <-- TypeError if a is undefined.

I mention undefined because Where the value on the LHS is undefined or
null and the value on the RHS does not have a window property.

var a;
a === [].window; // true, both are undefined.

But that can't happen in my code as it is now.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Downloading only a particular page/selective pages of a document from the internet or other file server - Free Tool Dusko Savatovic Windows Server 2 01-22-2010 04:47 PM
Re: Downloading only a particular page/selective pages of a document from the internet or other file server - Free Tool Dusko Savatovic Server Networking 2 01-22-2010 04:47 PM
Re: Mail window size Robert Aldwinckle Windows Live Mail 0 01-19-2010 01:10 AM
Window Vista Activation Problem Eduardo Windows Vista Installation 5 07-28-2007 01:28 AM
Owned window errantly made a topmost window. Chris Rehfeldt Windows Vista Performance 3 11-17-2006 02:40 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59