Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Regarding self

0 views
Skip to first unread message

Aaron Gray

unread,
Aug 18, 2008, 8:28:22 PM8/18/08
to
Regarding 'self' :-

if (self)
document.write( "self<br>");

if (self === window)
document.write( "self === window<br>");
else if (self == window)
document.write( "self == window<br>");

if (self === document)
document.write( "self === document<br>");
else if (self == document)
document.write( "self == document<br>");

if (window === document)
document.write( "window === document<br>");
else if (window == document)
document.write( "window == document<br>");

IE :-
self
self == window
self == document
window == document

FF, Opera, Safari :-
self
self === window

Aaron

Aaron Gray

unread,
Aug 18, 2008, 8:43:54 PM8/18/08
to
"Aaron Gray" <ang.u...@gmail.com> wrote in message
news:6guid8F...@mid.individual.net...
> Regarding 'self' :-

Here's alink to the 'self' test page :-

http://www.aarongray.org/Test/JavaScript/self-test.html

Aaron

Aaron Gray

unread,
Aug 18, 2008, 9:10:33 PM8/18/08
to
"Aaron Gray" <ang.u...@gmail.com> wrote in message
news:6guid8F...@mid.individual.net...
> Regarding 'self' :-

So why use 'self' at all ?

Why not just use 'window' instead for FF, Opera, and Safari ?

Are there some browsers that only support 'innerHeight/Width' on self ?

But then 'document.body.clientHeight/Width' give the same values as
'window.innerHeight/Width' so why use those.

I have only been testing this on the latest versions of the browsers, so I
maybe overlooking older incompatibilities. So if anyone can shed more light
on older browsers behaviour with/without this test page I would be most
thankful

Aaron

Aaron Gray

unread,
Aug 18, 2008, 9:38:53 PM8/18/08
to
"Aaron Gray" <ang.u...@gmail.com> wrote in message
news:6guksdF...@mid.individual.net...

> But then 'document.body.clientHeight/Width' give the same values as
> 'window.innerHeight/Width' so why use those.

I have found 'document.body.clientHeight/Width' may not be very useful
compared to 'window.innerHeight/Width' as on Safari 2.0.4 it is minus
document.body.margin'. And on Konqueror clientHeight/Width is much smaller
than the actual client area.

Aaron

0 new messages