Thomas 'PointedEars' Lahn said the following on 2/3/2006 11:54 AM:[color=blue]
> Randy Webb wrote:
>
> [Readded previously snipped code]
>[color=green]
>> Thomas 'PointedEars' Lahn said the following on 2/3/2006 8:50 AM:[color=darkred]
>>> Randy Webb wrote:
>>>> Thomas 'PointedEars' Lahn said the following on 2/2/2006 5:14 PM:
>>>>> Danny wrote:
>>>>>> I am having some odd problems with AJAX on Firefox (1.5). When I use
>>>>>> GET as the request method everything works ok, but when I do a POST
>>>>>> the remote function doesn't get the parameters I am passing to it.
>>>>>> Everything works fine on IE 6. Here's a couple samples of what I am
>>>>>> doing:
>>>>>>
>>>>>> // using GET
>>>>>> url = 'http://www.myserver.com/cgi-bin/funct?key1=value1&key2=value2'
>>>>> Declare all your variables using the `var' keyword always.
>>>> No. Declare all your variables using the 'var' keyword *unless* you
>>>> understand the ramifications of not doing so. In the global scope, there
>>>> is no difference in the following two script blocks:
>>>>
>>>> <script type="text/javascript">
>>>> myVariable = 'This is a global variable'
>>>> </script>
>>>>
>>>> <script type="text/javascript">
>>>> var myVariable = 'This is a global variable'
>>>> </script>
>>> Wrong.[/color]
>> Wrong Thomas.[/color]
>
> No, I am correct.[/color]
That is your opinion, and you are entitled to it. Your opinion is based
on ignoring *all* of what I wrote. But, that is your choice. Should
people use the var keyword? Sure. Can they do without it? Yes, but, only
if they understand the ramifications of not using it. The ramifications
part is what you are ignoring.
[color=blue]
>[color=green]
>> Let me quote what you ignored ok? Make sure you read it properly this
>> time:
>>
>> IN THE GLOBAL SCOPE.
>>
>> Get it now? In the GLOBAL scope they are equivalent.[/color]
>
> No, they are _not_, in /any/ scope. In the first case the scope chain is
> used; in the second case it is not.[/color]
You still didn't get it. If both of those script blocks are executed in
the global scope then they are both global variables. Show me some code
that shows otherwise though.
[color=blue][color=green][color=darkred]
>>> It has been proven before already that there can be an object in
>>> the scope chain, before the global object, that is a host object.[/color]
>> Irrelevant to what I said.[/color]
>
> It is very relevant to what you said.[/color]
No it's not. If you understand the ramifications, and the behavior you
get is what you are after, then you can do what you want. If you don't
understand, then take the safe path and use the var keyword.
[color=blue]
> You can seldom know, with Closed
> Source you can never know, the inner workings of the implementation used,
> including the scope chain. It is error-prone and eventually incompetent
> to ignore that.[/color]
Again, only if you don't understand the ramifications of not using the
var keyword.
If I repeat that enough, will you finally get it?
[color=blue][color=green][color=darkred]
>>> This is the case in JScript as used in IE: if there is an HTML element
>>> with name or ID of `myVariable' and `myVariable' has not been declared
>>> before, this assignment results in an error everywhere in the code
>>> because this host object implements the simple assignment operation
>>> differently than specified in ECMAScript Edition 3 (which is nevertheless
>>> ECMAScript compliant behavior.)[/color]
>> Yoohoo. Read what I wrote Thomas : "Unless you understand the
>> ramifications of not doing so".[/color]
>
> You yourself did not understand the ramifications of doing so (yet?).[/color]
You underestimate my understanding. I am well aware of what the
ramifications are.
[color=blue][color=green]
>> Sidenote: I don't give a crap what ECMA says.[/color]
>
> Then you are a fool because you are dealing with conforming implementations
> of ECMAScript (ECMA-262, ISO/IEC 16262).[/color]
I am a fool for not caring what a document says but rather I worry more
about what the browsers do? I can write cross-browser scripts and never
even know what ECMA says. You can not write cross-browser scripts based
solely on knowing what ECMA says. You *must* know the browser behavior.
And given a choice between MSDN and the Gecko docs versus ECMA's
documentation, you can have ECMA.
And to prove that point, it only takes using toFixed in IE and you will
soon find out that it's more important to know what the browser is going
to do than what ECMA says it should do because IE5.0 in its default
install configuration will fail with toFixed because its buggy.
[color=blue]
> Not only because I (and a considerable number of other participants of
> this newsgroup) say so, but because the creators of the respective script
> engines themselves say so.[/color]
ECMA is an attempt to standardize what was already in place. Not the
other way around.
Theory: ECMA should be all you need to know.
Reality: ECMA doesn't mean a hill of beans.
If it did, then the language would be ECMAScript and not J(ava)script.
[color=blue][color=green]
>> I care what the browsers do.[/color]
>
> Then read the previous discussion on the subject as I already suggested. It
> contains an example that _breaks_ in IE if the identifier is not a declared
> variable. It does _not_ break if it is.[/color]
And I already said that if you are stupid enough to fall into that trap
then you deserve what you get. That is one of the ramifications I was
referring to that you keep ignoring.
But, which is it? Are you going to stand behind ECMA or the browser's
behavior? You can't have it both ways.
[color=blue]
> BTW: You replied to a posting canceled (on Google Groups) and superseded
> with news:2045801.nuuUZg5zpb@PointedEars.de already.[/color]
BTW: It was not cancelled or I wouldn't have seen it. And you are
assuming that just because you went to Google and asked for the message
to be cancelled that it did indeed get cancelled - it didn't.
But, since you mention the double post, you should fix your newsreader -
it double posts quite a bit.
What? No more about the semi-colons?
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/