Subj : Re: JavaScript problem To : netscape.public.mozilla.jseng From : Brendan Eich Date : Sat Oct 11 2003 10:48 am Martin Honnen wrote: > Well, it is "working" in Mozilla too, only with a different result. > Change your code to > > var o = new function() { > var This = this; > > this.f = function() { > alert( This.f.caller ); > } > } > > function g() { > o.f.call(this); > } > g.p = "hello"; > > g(); > > and you will see what the caller function is, in Mozilla's case it is > the function > call > in IE's case it is the function > g > so that is why you get a different result (when reading the p property). > The caller property is nowhere defined in the ECMAScript edition 3, > indeed there are implementation like Opera 7's ECMAScript implementation > which do not implement caller at all. > It is therefore not possible to decide which implementation is right as > the spec doesn't tell. > > With Mozilla you need to access > This.f.caller.caller > if you are looking for the function g. > Or don't invoke f using call, just call o.f(this) inside g. /be .