I was having problems at the new Starcraft II site <http://www.starcraft2.com>.
I narrowed it down to a problem in <http://www.starcraft2.com/js/tooltip.js>, which is a modified copy of the Dynamic Drive DHTML tooltip script. Here's an excerpt:
//var tipobj = document.getElementById("dhtmltooltip");
This boils down to "if (x) function y()", which is a syntax error in our implementation, but works fine in Firefox at least. I didn't test IE, but I'm pretty sure it works fine there.
This is a case where matching the ECMAScript standard is causing compatibility problems.
Another Starcraft II bug: Bug 13787. Not sure if they're related or not.
Created attachment 19187 [details]
I have attached an example where the SyntaxError occurs. This is a weird ECMAScript implementation issue. The script doesn't cause errors in IE7 and FF3.
If you look at http://www.starcraft2.com/js/tooltip.js, you will notice that the 'if' is also commented. It seems that they did not mean to comment only the var statement. The original source for that JS library also seems to support this: http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm.
Can we close this bug?
I'm sure others will make this mistake again in the future on other websites. But maybe it's OK if we behave differently.
*** Bug 14090 has been marked as a duplicate of this bug. ***
I will probably just do this. It will avoid future compatibility issues and it will even simplify our grammar.
Created attachment 25467 [details]
Proposed patch (without test)
Here is a patch that fixes this problem. I will add some tests for this new behaviour and put it up for review.
Created attachment 25474 [details]
Comment on attachment 25474 [details]
Landed in r38747.