On Jan 14, 2:45 am, cancel bubble <[email protected]> wrote: > Hello all, > > I'm attempting to build a little utility script I can include in all my dev > projects/environment that will report any global variables. I can then > investigate these globals and leave as-is ($ and jQuery for example) or > hopefully correct them to not be globals. The goal is to reduce the number > of global variables. My dev environment is currently Firefox so that's the > only browser I'm concerned with this running in (at the moment). I have an > initial script up at: > > http://jsbin.com/oniyi3 > > And would love some feedback, particularly in how I'm detecting global > vars. What I came up with doing is: > > Iterate through the global window object to generate a list of all the > native global properties in my current version of Firefox. I did this via > the console.log() and just copied/pasted the results into an array. You'll > see this at line 75. I then basically do the same thing again and compare > with this "native_firefox" array. Any differences would be the user-defined > globals, which is what I'm interested in. I then just output them at the > top right of the screen and I've got a list of globals to investigate. > > My concern with the "native_firefox" array is new properties are going to > show up with new versions of Firefox so it's a manual maintenance issue, > which I'd love to avoid. > > Is there an automated way to get a list of all native global properties? >
An IFRAME is the right way to go... Compare global properties of a native IFRAME with those of your global scope. -- Diego > Thanks! -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
