Lazyloading breaks Javascript
-
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
The topic ‘Lazyloading breaks Javascript’ is closed to new replies.