"Fox" <fo*@fxmahoney.com> wrote in message
news:3F***************@fxmahoney.com...
"Richard A. DeVenezia" wrote:
Hi:
function foo () {
var xyz = 123;
function bar () {
var abc = 456;
}
}
I can alert (foo) to see the function source
Is there an alert (<something>) that will show me only the source of
function bar inside function foo ?
Richard A. DeVenezia
This works (as you've declared foo) in Netscape browsers:
alert(foo.bar);
Another instance where JScript is not like JavaScript.
functions are objects / objects are functions
Does NS permitting foo.bar imply it implictly thisifies a function in a
function and implicity (anonymously?) instantiates the function when
invoked?
Does ECMA script spec indicate foo.bar should work as in NS ?
Or should I get out of the deep end of the pool...
This is a way that 'works' in IE (and I presume NS), however to use the
funtion _I_ would have to instantiate it first, and use news to get at inner
function declarations, which is annoying. Does NS handle nesting > 1
(outer.inner1.inner2) ?
function outer () {
// outer
this.innerOne = function () {
// inner 1
this.innerTwo = function () {
// inner 2
}
}
}
alert (outer) // IE source
alert ((new outer).innerOne) // IE source
alert ((new (new outer).innerOne).innerTwo) // IE source
alert (outer.innerOne) // IE undefined
alert (outer.innerOne.innerTwo) // IE error
--
Richard A. DeVenezia