HighDots Forums  

Getting supported methods of objects

Javascript JavaScript language (comp.lang.javascript)


Discuss Getting supported methods of objects in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brian
 
Posts: n/a

Default Getting supported methods of objects - 09-25-2003 , 09:14 AM






Hello,

I am working on a utility script to browse the supported objects in a
browser. I know I can get the object members, by:

for( member in eval(obj_name) )

but, is there something similar for getting all of the methods?

Thanks,
Brian

Reply With Quote
  #2  
Old   
Lasse Reichstein Nielsen
 
Posts: n/a

Default Re: Getting supported methods of objects - 09-25-2003 , 11:18 AM






genisiob (AT) pilot (DOT) msu.edu (Brian) writes:

Quote:
I am working on a utility script to browse the supported objects in a
browser. I know I can get the object members, by:

for( member in eval(obj_name) )
.... but you shoudn't use eval like that. If obj_name contains the name
of a global variable, just write "window[obj_name]". If nothing else,
it is probably orders of magnitude faster that using eval.

Quote:
but, is there something similar for getting all of the methods?
There is no difference between "members" and "methods" in Javascript.
They are all object properties. The for(..in..) construction iterates
throught all the *enumerable* properties. There is no easy way to find
the names of non-enumerable properties (like all the properties of
the array prototype). So, no.


/L
--
Lasse Reichstein Nielsen - lrn (AT) hotpop (DOT) com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.