Subj : Re: JavaScript problem To : netscape.public.mozilla.jseng From : Martin Honnen Date : Sat Oct 11 2003 12:43 pm Adrian Herscu wrote: > Hi all, > > Using: > Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507 > > The following script is working in IE6.0: > > "http://www.w3.org/TR/html4/strict.dtd"> > > > > > > > > > > > Any idea? 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. -- Martin Honnen http://JavaScript.FAQTs.com/ .