kjs: variables with/without var [PATCH]

Harri Porten porten at kde.org
Thu Jan 23 21:19:00 GMT 2003


On Thu, 23 Jan 2003, David Faure wrote:

> On Thursday 23 January 2003 21:53, David Faure wrote:
> > Let's see ... Oh yes, you're right. At least in mozilla, alert(self) shows that
> > the global object is indeed the frameset, in SomeFunc(), even when called
> > from the frame.
> 
> Flawed reasoning. It simply means that the frameset's globalobject is in
> the scope chain (and that the calling frame's globalobject is either not
> in the scope chain, or is after the frameset's one).

Hmmm. Okay, that's where the self property is found. Examing "this" might
bring final clarity.

> I believe Maciej is correct then. The right place to put new vars is the last
> item in the scope chain. Will try that (this bugfix is quite urgent, the 3.1 code
> has been updated to include this, it seems :(((

I agree that this is the safest bet for a quick 3.1 fix. In the long run
we might want to consider if the equality of global object and last item
is 100% true and then make them synonyms. Ideally by Maciej's second
suggestion of modifying the getter function. For the sake of clarity vs.
a mixed usage.

Harri.





More information about the kfm-devel mailing list