Support » Plugin: Anti-spam » Problem with minification plugins – use strict should be wrapped inside function

  • Hi,

    “use strict” statement should be used below “(function() {” statement inside plugin main js file, not above, as it breaks JavaScript code in specific browsers when using minification and concatenation plugins.

    Please consider changing this in the next update.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor webvitalii

    (@webvitaly)

    Can you provide more details?
    How minified file looks like?
    Which browsers are affected?
    What tool are you using to minify js file?

    Hi,

    We have fixed it by just moving “use strict” inside your function wrapper. It isn’t actually a bug with your code. It is logical, because, most minification plugins are concatenating scripts inside a single file and since your “use strict” call is defined outside of your main JS wrapper function, it is detected within “global” scope which means that it affects all other scripts which are mixed together and some of them won’t work with “use strict”. It is more safe to call it inside your function instead of above. So, sometimes it works fine, sometimes not, depending of other scripts which are minified alongside your js file.

    If you need more details, feel free to contact us directly via office[at]mekshq.com and we would be glad to discuss further.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with minification plugins – use strict should be wrapped inside function’ is closed to new replies.