Bug in image lazy loading and JSON/Ajax




Wordpress LScache Plugin: Bug in image lazy loading and JSON/Ajax

Last Updated on: Wed, 15 Apr 2026 00:00:02
I think I found a bug in the plugin but not 100% sure. Here is the explanation: The theme I am using implements infinite scroll for images by downloading all data and embedding it within HTML as JSON. Then it uses ajax to render the content of the JSON upon user clicking more? (not the best way to do infinite scrolling but this is how it is). Apparently, lscache replaces original img tags with its own lazy loaded img tags without doing proper escaping which causes a syntax error when parsing the JSON by the Ajax code. Regardless of the specific use case, I think the bug is general since lscache should check the context in which the img tag (or any other tag modified by the plugin for caching purposes) is found and if it is within a JSON output (or any other format/context that is not HTML) then either do proper escaping or leave the tag as is. Thanks The page I need help with: https://www.baity.cc/decor/portfolios/ I disabled image lazy loading and the JS syntax error in the console disappeared. I am trying to find a way to keep the lazy loading while still doing the proper escaping required by JSON.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference