Thomas 'PointedEars' Lahn wrote:
[color=blue]
> "Grant Wagner" schrieb:
>
>[color=green]
>>"Thomas 'PointedEars' Lahn" <PointedEars@web.de> wrote [...]
>>[color=darkred]
>>>"Grant Wagner" schrieb:
>>>
>>>>It's window.location.href (or simply location.href).
>>>
>>>Or even more simple `location' :)[/color]
>>
>>I don't like assigning a String value to a Location object, no matter
>>what the underlying implementation does for me and I think it was a
>>mistake to implement it that way.[/color]
>
>
> Well, using `location' instead of `location.href' workarounds the
> Same Origin Policy by design, so you really should consider it.[/color]
No, if it lets you get around SOP then its a security flaw and should
*not* be considered.
[color=blue]
>[color=green]
>>It interferes with trying to teach proper OO concepts,[/color]
>
>
> On the contrary. It teaches that an object has a value and still more
> properties.[/color]
No it doesn't. It teaches people bad habits by not learning what is
underlying and relying on the browser to handle it.
[color=blue][color=green]
>>and leads to statements like "JavaScript supports associative arrays"
>>because the concept of objects, properties and methods becomes hazy
>>and meaningless.[/color]
>
>
> I think if people want to have misconceptions, there is no way talking
> them out of them.[/color]
No, but, you *can* keep from propogating mis-understandings.
[color=blue]
>[color=green]
>>For the sake of 5 characters,[/color]
>
>
> .... and another lookup operation probably reducing efficiency ...[/color]
That lookup has to happen either way. It's probably quicker to use .href
because then the browser doesn't have to guess what to do with the
string, the author has already told it.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly