J
James Marshall
Does anyone know....
In JavaScript, is there any way to get a reference to a string variable
(not an object), like Perl's "\" operator? I want to be able to compare
two such references and know if they point to the same string variable.
Alternately, is there a way to access the call object in a function, i.e.
the object that function-local variables are a part of? How about the
chain of call objects, e.g. if function a() calls function b(), then from
within b() is it possible to get function a()'s call object? I don't
think Function.caller does this, and that's deprecated anyway.
The problem is this: I have an app that reads and modifies JS code in Web
pages. In the following code I need to know whether the "src=bar" line
operates on the global window.src, or on the local "src" variable in f(),
when the "var src" line may or may not be there. Is there any way to do
this, short of parsing the function and keeping track of all "var"
declarations?
src= foo ;
function f() {
src= bar ;
In JavaScript, is there any way to get a reference to a string variable
(not an object), like Perl's "\" operator? I want to be able to compare
two such references and know if they point to the same string variable.
Alternately, is there a way to access the call object in a function, i.e.
the object that function-local variables are a part of? How about the
chain of call objects, e.g. if function a() calls function b(), then from
within b() is it possible to get function a()'s call object? I don't
think Function.caller does this, and that's deprecated anyway.
The problem is this: I have an app that reads and modifies JS code in Web
pages. In the following code I need to know whether the "src=bar" line
operates on the global window.src, or on the local "src" variable in f(),
when the "var src" line may or may not be there. Is there any way to do
this, short of parsing the function and keeping track of all "var"
declarations?
src= foo ;
function f() {
src= bar ;