R
RobG
In Firefox if an HTML page is not hosted inside a frame or iframe, the
following return true:
(window === window.self);
(window === window.parent);
But in IE they return false (using == returns true for both). Can
someone explain why?
Saying "It's DOM 0 so anything goes" is a cop-out.
A test:
function testSelf()
{
alert('window === window.self: ' + (window === window.self)
+ '\n'
+ 'window === window.parent: ' + (window === window.parent)
);
}
window.onload = testSelf;
And in a related incident... testThing() returns true in both browsers:
function Thing(){
this.mySelf = this;
}
function testThing()
{
var x = new Thing();
return x.mySelf === x;
}
alert(testThing());
following return true:
(window === window.self);
(window === window.parent);
But in IE they return false (using == returns true for both). Can
someone explain why?
Saying "It's DOM 0 so anything goes" is a cop-out.
A test:
function testSelf()
{
alert('window === window.self: ' + (window === window.self)
+ '\n'
+ 'window === window.parent: ' + (window === window.parent)
);
}
window.onload = testSelf;
And in a related incident... testThing() returns true in both browsers:
function Thing(){
this.mySelf = this;
}
function testThing()
{
var x = new Thing();
return x.mySelf === x;
}
alert(testThing());