Formatting strings

L

Lasse Reichstein Nielsen

Thomas 'PointedEars' Lahn said:
Because you cannot rely on what iteration shows, is there a way to get
all properties of an object other than brute force, and if that, how it
is done?

No. You can only get the enumerable properties. For the rest, you must
do a brute force search (i.e., you can't in practice).

In Opera, only methods are generally enumerable, and not even all of
them. The enumerable properties of O7's location object are:
assign, reload, replace, toString, and valueOf
As you say, in O6, there are no enumerable properties.
I don't have Opera 3 installed,

See [1].

I have it, it's just not installed right now :)
It also says:

| The location object is contained by the window object and is within its
| scope. If you refer to a location object without specifying a window, the
| location object represents the current location. If you refer to a
| location object and specify a window name, as in windowReference.location,
| the location object represents the location of the specified window.

That just sounds like normal scope rules when the "current" window object
is also the global object of the execution context. Location objects are
just properties of window objects.
and BTW, your `x' is not a Location object.

Nope. But they did say that if you assigned to the location property
of an object, it would create a location object in its place. Apparenty
it is only true for window objects.

/L
 
N

Nige

In said:
That has nothing to do with CGI as you have told before!

No, indeed, it was my flawed understanding of the object returned from
the .location property. All sorted now.

Next year I'm going to be teaching a university course that involves JS,
all I have to do is stay one step ahead of the students ;-)
 
R

Richard Cornford

Lasse Reichstein Nielsen said:
No. You can only get the enumerable properties. For the rest,
you must do a brute force search (i.e., you can't in practice).
<snip>

Do you really mean you can't in practice? Certainly it would not be
practical to test every combination of character sequence that could be
a property name (the end on the universe would arrive before the
results), but I don't see a problem with trying each item in a list of
likely property names against an object to see which return
non-undefined values. Then the usefulness of the results only depends on
the quality of the list of likely property names. It wouldn't be quick
but it wouldn't be so slow as to be impractical.

Richard.
 
L

Lasse Reichstein Nielsen

Richard Cornford said:
Do you really mean you can't in practice? Certainly it would not be
practical to test every combination of character sequence that could
be a property name (the end on the universe would arrive before the
results),

Find them all, no. It is indeed the heat death of the Universe that
prevents that.
but I don't see a problem with trying each item in a list of likely
property names against an object to see which return non-undefined
values.

Absolutely possible. Later versions of Javascript even has a way
to check whether an object has a property ("foo" in obj).
Then the usefulness of the results only depends on the
quality of the list of likely property names. It wouldn't be quick
but it wouldn't be so slow as to be impractical.

If you know what to look for, it is easier to find it :)

/L
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Because it is a campaign site for broadband in Kent.

I am reliably informed that there is a modicum of Kent that keeps Paris
Time. However, they are probably not possible direct customers for the
broadband service. And if they were, they might be customers best
avoided (on mere pragmatic grounds; nothing uncomplimentary).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top