Path: csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Recursively enumerating the global object Date: Sat, 05 Dec 2015 10:16:34 +0100 Organization: PointedEars Software (PES) Lines: 54 Message-ID: <1696024.u3LjWGVPF4@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1449306996 4130 eJwFwQcBACAIBMBKCs+Kg4z+EbwT1qtlUFHIyqIHgnjD4gw7uAZM7IlecvMpSp3OeuaVZB8O0hEX (5 Dec 2015 09:16:36 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 5 Dec 2015 09:16:36 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQkBACAIBLBKIn8cPKB/BDdlI4OLqYmubs5YPQ6B82lCm2w9PDXqO82ZDLlaXX3gyVwVV5QQPTjhH3FrFhs= Cancel-Lock: sha1:+Kp93lVT6piB8DIbUZXWVSexMDQ= X-NNTP-Posting-Host: eJwFwYEBACAEBMCViP8YR8r+I3QHo7K3E3QMpgU4rPQK0SysEaKjErTRwmXE2/cw39rX+AEQFxC0 Xref: csiph.com comp.lang.javascript:28978 Stefan Ram wrote: > ram@zedat.fu-berlin.de (Stefan Ram) writes: >>ram@zedat.fu-berlin.de (Stefan Ram) writes: >>>It worked when I inserted the script into a web page. >>>Here's the last version: >>I'd like to show /all/ the information (except function >>bodies) that can be reached via the global object in >>Mozilla® Firefox. Please let me know if I still should >>have missed some information. > > My code used to produce about 1600 lines, but now it > produces a whopping 19000 lines! You are making the mistake to equate quantity with quality. > I remembered that functions are objects too, and now also dump all > functions as object. > > Finally, a use case for the fall-through in a switch-statement! > An excerpt from the current source code (simplified): > > ... > switch( typeof( arg )) > { > > case "function": > writeline( path + " = " + t + " : " +( arg.name ? arg.name : "" )); > > case "object": > ... I commend your efforts (even though I still find your code style suboptimal at best). But you do not realize that you are not the first person to try this, that function serialization as such and certainly in advance is not a good idea (especially writing out function code in HTML without escaping), and that both the built-in script consoles and Firebug provide this information in a more user-friendly and context-sensitive way: Just type the expression, e.g. “Math” and click the result, or type, e.g. “inspect(Math)” and see the result in the Inspector pane (right-hand side if the console is displayed horizontally, on the bottom if vertically). Also, the console (in single-line mode; Firebug also has a very useful editor mode) has auto-completion and tab completion. (see also the FAQ) -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.