• ResolvedPlugin Author Frank Goossens

    (@futtta)


    Afraid by solving one bug (comment tags that contained javascript or css were not ignored) another one got introduced; inline javascript between comment tags (as used to be done not to affect old browsers) gets broken.

    A fix for this is coming soon (Monday or Tuesday), but for those who want to fix this now;

    1. open /wp-content/plugins/autoptimize/classes/autoptimizeScripts.php
    2. on line 158 (before the “//Check for already-minified code”) add this:
      $this->jscode = $this->restore_comments($this->jscode);
    3. save changes and empty autoptimize cache

    For those implementing this; do confirm if solves your issues!

    (theoretically the same could happen with style-tags containing HTML-comments, but the chances of that happening are smaller, no “historic notation” to be taken into account)

    sorry for the trouble guys & girls!
    frank

    https://wordpress.org/plugins/autoptimize/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Frank Goossens

    (@futtta)

    Forget about the fix above (which was not complete), just install this test-version of 1.8.4 and confirm if this works or not.

    Plugin Author Frank Goossens

    (@futtta)

    1.8.4 got release a couple of hours ago, this is fixed now.

    When Google Tag Manager is used, the script is moved to the .js in at the end of the page. It seems this occasionally causes issues, where the tags are not loaded. I am choosing now to only combine the Javascript in the head, so the script in the Tag Manager is preserved.

    Plugin Author Frank Goossens

    (@futtta)

    Morgend Lijndiensten;
    Can’t you just exclude that script from optimization?

    frank

    I am not sure, but I didn’t think so, since it’s an inline script:

    <!-- Google Tag Manager -->
    <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXX"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXX');</script>
    <!-- End Google Tag Manager -->
    Plugin Author Frank Goossens

    (@futtta)

    I’d assume excluding on “gtm.start” or “googletagmanager” would work. Did you try that?

    Either gtm.start or googletagmanager, they both do the trick. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘bug in 1.8.3: inline javascript between comment tags broken’ is closed to new replies.