Default value of JS window object

Harri Porten porten at trolltech.com
Fri Jul 5 16:55:23 BST 2002


On Fri, 5 Jul 2002, Koos Vriezen wrote:

> > Question: have you encountered this problem in a real world web page ?
> 
> Only if I'm part of it ;). Anyway, window.toString also doesn't exist.

That is the source of the problem. The window object needs a
Object.prototype prototype as far as I can tell. This way it should get
toString() automatically.

> Btw, the same exception is thrown doing a
> 'window=="I'm a string, not a window"', which isn't such a strange test
> to do IMO. (Of course it should always return false, even if
> 'window=="[object Window]"' is evaluated.)

It's all using the same (missing) mechanism.

> Hmm, that funny 'document=="[object HTMLDocument]"' returns 'true'. Should
> it?

HTMLDocument is the proper DOM name IIRC. The whole "[object X]" thing is
completely arbritrary according to the spec. We just do the same as other
browsers (at least NS) here.

Harri.






More information about the kfm-devel mailing list