Thomas 'PointedEars' Lahn said:
On the contrary. It teaches that an object has a value and still more
properties.
Except it the Location object doesn't have a value.
The implementation described by Netscape's documentation <url:
http://docs.sun.com/source/816-6408-10/location.htm />:
If you assign a string to the location property of an object, JavaScript
creates a location object and assigns that string to its href property.
For example, the following two statements are equivalent and set the URL
of the current window to the Netscape home page:
window.location.href="
http://home.netscape.com/"window.location="
http://home.netscape.com/"So
in at least one browser:
window.location = 'url';
is:
var s = 'url';
window.location = new Location();
window.location.href = s;
I don't see how hiding this fact helps anyone.
window.location contains a reference to a Location object, the Location
object has no value, it has properties. If you assign a string to the
window.location property containing the Location object reference, the
browser waves it's hands, says a magical incarnation and assigns that
string to the href property of a Location object referred to by
window.location.
This all has the madness of default properties in VisualBasic.
... and another lookup operation probably reducing efficiency ...
1) the inefficiency is negligible
2) if the description in the Netscape documentation is anywhere close to
accurate, assigning a string to the location property of the window
object actually involves _more_ work.