I have a function source() to show the definitions of functions passed to it
function sourceAsHTML() {
var s=''
for (var i=0; i<arguments.len gth; i++) {
alert(arguments[i])
s +=
'<PRE>'
+ arguments[i].toString().rep lace (/</g, '<')
+ '</PRE>'
}
return s
}
and it works nicely, except in the case of a class prototype assigned to an
anonymous function
i.e.
function myClass () {}
function myClass.prototy pe.foobar = function () { /* foobar */ }
alert (sourceAsHTML(m yClass.prototyp e.foobar))
.....
the alert shows
<PRE>function () { /* foobar */ }</PRE>
which is close, but it doesn't show that it 'belongs' to
myClass.prototy pe.foobar.
So the question is, when passed a function as an arg is there a way to know
the function name or context (i.e. prototype) ?
--
Richard A. DeVenezia
function sourceAsHTML() {
var s=''
for (var i=0; i<arguments.len gth; i++) {
alert(arguments[i])
s +=
'<PRE>'
+ arguments[i].toString().rep lace (/</g, '<')
+ '</PRE>'
}
return s
}
and it works nicely, except in the case of a class prototype assigned to an
anonymous function
i.e.
function myClass () {}
function myClass.prototy pe.foobar = function () { /* foobar */ }
alert (sourceAsHTML(m yClass.prototyp e.foobar))
.....
the alert shows
<PRE>function () { /* foobar */ }</PRE>
which is close, but it doesn't show that it 'belongs' to
myClass.prototy pe.foobar.
So the question is, when passed a function as an arg is there a way to know
the function name or context (i.e. prototype) ?
--
Richard A. DeVenezia
Comment