Re: (window == any_element) always return true in IE6?
- From: "Evertjan." <exjxw.hannivoort@xxxxxxxxxxxx>
- Date: 30 Aug 2007 17:57:10 GMT
David Golightly wrote on 30 aug 2007 in comp.lang.javascript:
Disregarding for a minute the script tag you have outside your HTML
tag (invalid!), this does indeed seem to be true: JScript in IE6 & IE7
seems to have a non-transitive comparison operator. You can try it by
navigating to http://www.google.com on IE and copy/pasting the
following into your address bar:
javascript:var g=document.getElementById('lgpd');alert((window==g)+','+
(g==window));
Now *THAT* is some serious junk code.
Let's keep it simple and compare:
<body>
<script type='text/javascript'>
var g=document.body;
alert((window == g)+','+(g == window));
</script>
and:
<body>
<script type='text/javascript'>
var g=document.body;
alert((window === g)+','+(g === window));
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.
- Follow-Ups:
- Re: (window == any_element) always return true in IE6?
- From: David Golightly
- Re: (window == any_element) always return true in IE6?
- References:
- (window == any_element) always return true in IE6?
- From: Fan
- Re: (window == any_element) always return true in IE6?
- From: David Golightly
- (window == any_element) always return true in IE6?
- Prev by Date: Re: (window == any_element) always return true in IE6?
- Next by Date: Re: (window == any_element) always return true in IE6?
- Previous by thread: Re: (window == any_element) always return true in IE6?
- Next by thread: Re: (window == any_element) always return true in IE6?
- Index(es):