> On Wed, Aug 11, 2010 at 11:06 AM, Alexandre Morgaut <morgaut@...>wrote:
In your original message, catch(error) generates multiple definitions in the
routine's scope (at least in IE).
var a = 1;
var a = 2;
The second 'var a' is the same as the first one, 'func1(true)' will display
'2' and you'll also have a 'b' variable declared at the end of the routine.
This is why we have ugly code for handling events in JS, because IE doesn't
send the parent event on onclick for example:
if (!evt) var evt = window.event; // just for IE, isn't that ugly ?
I also saw terrible code, where people didn't use the var keyword:
for(i = 0;i<10;++i) // yes, this variable is global !!!
I found these bugs when dumping the global variables.
On Wed, Aug 11, 2010 at 11:06 AM, Alexandre Morgaut <morgaut@...>wrote:
> Well it shouldn't
> On which browser did you test it ?
> On Firefox
> - this generate a ReferenceError: "error is not defined"
> On Safari:
> - this generate also a ReferenceError: Can't find variable: error
> which is good
You are nit-picking.
The example boyopeg has provided is probably not the best one, since the
behaviour is different from a browser to another.
But anyway, we are all trying to write cross-browser code, so we ultimately
need to consider IE's limitations.
[Non-text portions of this message have been removed]