What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

Possible Duplicate:
JS broken in Chrome 18

when I click 'add comment', nothing happens. Same goes for:

-'Stack exchange' in the header to view messages/hot topics
-'show other means of login' on login page
-vote
-rich text edition isn't available

if it can be of any use, here's some console output:

stub.js:11Uncaught SyntaxError: Variable 'g' has already been declared
ask:21Uncaught ReferenceError: StackExchange is not defined
ask:68Uncaught ReferenceError: StackExchange is not defined
ask:76Uncaught ReferenceError: StackExchange is not defined
ask:178Uncaught ReferenceError: StackExchange is not defined
ask:219Uncaught ReferenceError: StackExchange is not defined
ask:242Uncaught ReferenceError: StackExchange is not defined
ask:269Uncaught ReferenceError: StackExchange is not defined
ask:317Uncaught ReferenceError: StackExchange is not defined
ask:374Uncaught ReferenceError: StackExchange is not defined 
share|improve this question

marked as duplicate by Arjan, kiamlaluno, animuson, ChrisF, Pops Jul 24 '12 at 15:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Hit Ctrl+F5/clear your cache. Done. –  Time Traveling Bobby Jul 18 '12 at 14:54
2  
See meta.stackexchange.com/questions/118976/js-broken-in-chrome-18 (although that's status-completed, so not VtC as a duplicate). –  Matt Jul 18 '12 at 14:54
    
@UristMcBobby: I doubt that'll fix it. See meta.stackexchange.com/questions/118976/js-broken-in-chrome-18 –  Matt Jul 18 '12 at 14:55
    
@Matt that solved the problem, thanks. Cache cleaning didn't help. –  BiAiB Jul 18 '12 at 15:25

1 Answer 1

up vote 5 down vote accepted

There are several interesting aspects to this.

  1. It turns out that variable redeclarations aren't actually illegal, even in strict mode. That suprised me a bit (I'd say this usually means there's a bug).
  2. The variable g that has already been declared appears once as a formal parameter in the function definition, and once in a var declaration. So there's no double var.
  3. This double g doesn't actually exist in our original code; it's only created by the minifier. The original unminfied version says:

    var fireConditionalCallbacks = function(objectName) {
        var callbacks = _conditionalCallbacks[objectName],
    

    The minified version (essentially) says:

    var n = function(g) {
        var g = a[g],
    

    Even if that's legal, as it appears to be the case, I'm not sure that's a good idea. I consider it highly confusing what the Closure compiler does there, but oh well…

  4. Anyway, the most important point: The error you're seeing was a browser bug. More precisely, it was a bug in V8 (Chrome's JavaScript engine) that was fixed a long time ago. In Chromium/Chrome 20, it doesn't appear, even with the experimental setting enabled. So just update your browser, and you should be fine (or leave experimental JS disabled).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .