Support » Plugin: Easy FancyBox » FireFox error because of missing ‘;’ breaks EasyFancyBox (failure prevents bind)

  • Resolved Alexis Wilke

    (@alexiswilke)


    I applied a small fix to your code in order to fix this problem.

    There is your original on line 205-206 of “wp-content/plugins/easy-fancybox/inc/class-easyfancybox.php”:

    }
    var easy_fancybox_auto = function(){';

    As we can see, we close a } and then we have a var. By adding a ; after the }, it works for me:

    };
    var easy_fancybox_auto = function(){';

    I have FireFox version 59.0.

    Without the ; I get an error in the console saying that it is missing. It’s good practice to end all your JavaScript lines with a ; anyway.

    Because of that error, the jQuery bind() does not occur and my images don’t get fancied as expected.

    • This topic was modified 5 years ago by Alexis Wilke. Reason: Added line # and filename to make it easy to find the code to fix

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Alexis Wilke

    (@alexiswilke)

    As a side note, the last } in that script has the same problem, although it’s find because it’s currently the last character. My point of view is that it should also be ended with ;. (Line 230, same file)

    Thread Starter Alexis Wilke

    (@alexiswilke)

    FYI, the problem arise as a compatibility issue because I have a plugin that compresses JavaScript. Now you could say that I should turn that off or that their stuff is bogus. Frankly, for a couple of ;, I think we can add them to your plugin. It will make your code that much stronger anyway.

    The compression (minifier) plugin that I use is named: “Minify HTML”

    https://wordpress.org/plugins/minify-html-markup/

    I would think that pretty much any JavaScript minifier will have the exact same problem with your code. So I wouldn’t put that on the back of the minifier.

    Actually, for the same number of characters, you can replace the newline with the semicolon:

    };var easy_fancybox_auto=function(){';

    And to save even more you can remove the spaces around the = sign.

    Plugin Author Rolf Allard van Hagen

    (@ravanh)

    Hi @alexiswilke well spotted and thanks for sharing! I’ll update right away 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘FireFox error because of missing ‘;’ breaks EasyFancyBox (failure prevents bind)’ is closed to new replies.