473,419 Members | 4,382 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

is it possible to loop through all objects?

If you have a javascript interpreter running in an environment unknown
to you (as in what objects it exposes to the language) is it possible
to loop through all objects in some way?

This is a non-browser environment, specifically the scripting engine
for doing xslt extensions in msxml.
Jul 20 '05 #1
1 1083
br*@itnisk.com (Bryan) writes:
If you have a javascript interpreter running in an environment unknown
to you (as in what objects it exposes to the language) is it possible
to loop through all objects in some way?
Only by brute-force exhaustive search. I.e., no.

Javascript allows you to find only some of the properties of objects,
those that are enumerable. You find them using
for (var propName in object) { ... }
Those that are not enumerable cannot be seen except by knowing their
name. One example is Object.prototype.toString. You know it is there,
but if you didn't know its name, you wouldn't be able to find it except
by trying all strings as property names and see if they exist. Since
there are infintly many strings, that won't work. Restricting to only those
of, say, 32 letters or below, will make it a finite problem. Sadly,
the universe is probably also final, and could end before you finish :)
This is a non-browser environment, specifically the scripting engine
for doing xslt extensions in msxml.


That depends on that specific environment. If none of the properties it
adds are non-enumerable, then you can find them. Otherwise, you can't.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: hazz | last post by:
given namespace WindowsService1 { public class Service1 : System.ServiceProcess.ServiceBase......... private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { ArrayList...
4
by: Zark3 | last post by:
Hi all, I was wondering if anybody could enlighten me on the possibility of dynamic casting. Or, well, whether or not I'm actually trying to do this the right way. What I have is a base class...
25
by: jwrweatherley | last post by:
I'm pretty new to python, but am very happy with it. As well as using it at work I've been using it to solve various puzzles on the Project Euler site - http://projecteuler.net. So far it has not...
9
by: igor.tatarinov | last post by:
Hi, I am pretty new to Python and trying to use it for a relatively simple problem of loading a 5 million line text file and converting it into a few binary files. The text file has a fixed format...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.