• Resolved dK

    (@dkristanda)


    Hi,

    This is a very confirmed bug! Cause me a lot of headaches.. but at least I found the exact root cause.

    Using Version 0.11.0, when the lazy load is enabled (General Setting=> User Experience=> Lazy Loading) any image tag that is inside a javascript variable would be broken/not valid. Cause: the regex string-replacement, perform by LazyLoad_Plugin.php put class=”lazy” and placeholder src=”data: …” into the img tag without escaping the quote.

    For example, put the following simple script to the page:

    <script>
    var mydef ={"myimage":"<img src=\"https:\/\/www.example.com/myimage.jpg\" alt=\"image desc\">"}
    </script>
    

    If the lazyload is active, the javascript will breaks into:

    <script>
    var mydef ={"myimage":"<img class="lazy" src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E" data-src=\"https:\/\/www.example.com/myimage.jpg\" alt=\"image desc\">"}
    </script>
    

    The search and replace should be done in two separate ways diferrentiating javascript block and html block.

    Hope this can be rectified soon, in the meantime, lazy loading is off
    Thanks
    Regards,
    dk

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Side note: could you please leave out [Bug] in the topic titles? I removed that. Wrapping something in the title [like so] doesn’t do anything and the forums already do that for [ Plugin or theme name ].

    Thread Starter dK

    (@dkristanda)

    I see, thanks for letting me know!
    I think it is a very useful denominator for support personnel to differentiate with a general question. Can I use the word without square bracket? i.e: “Bug: topic”
    Thanks

    Thread Starter dK

    (@dkristanda)

    Hi W3TC team,

    Similar bug also happen in Cdn_Plugin.php when there is a set of source image srcset inside a javascript parameter. The culprint is function _srcset_replace_callback()

    It changes the correct javascript code of:

    <script>
    var myimage = "<img srcset='image2x.jpg 2013w, image1x.jpg 1006w' src='image.jpg'>"
    </script>
    

    to

    <script>
    var myimage = "<img srcset="image2x.jpg 2013w, image1x.jpg 1006w" src='image.jpg'>"
    </script>
    

    (Note the unescaped quotes)
    Neeed to distinguish html block with javascript block

    Thanks

    p.s: in my case all the above is relevant as Elegant Themes is using lots of responsive design process using javascript. Also any site that use ajax that deal with images could be affected.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @dkristanda

    Thank you for bringing this to our attention.
    We are checking this and will reply as soon as we inspect this!
    Thank you!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @dkristanda

    Once again thank you for bringing this to our attention. This is now confirmed and I’ve open an issue on your behalf in our GitHub public repository. Please make sure to follow the progress of the issue on a regular basis.
    Once again thank you for bringing this to our attention.

    Thread Starter dK

    (@dkristanda)

    You’re welcome. Just tiny contribution from my part who benefiting from this plugin that can be used for free…

    I hope you don’t mind if I lodged such finding in this support forum as imho, it might help other users more than just directly go to Github.

    Because you are so responsive, it also gives a good message that this plugin is being looked after very well.

    Merry Christmas
    Cheers,
    dk

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @dkristanda

    Absolutely, this is what this public forum is for. And thank you one more time for posting issues and bringing them to our attention!
    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @dkristanda

    Sorry for the late reply!
    This issue was fixed in 0.12.0 Release.
    Also, there is a new 0.13.0 release with more fixes.
    Thank you for your patience!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Lazyloading breaks Javascript’ is closed to new replies.