Support » Plugin: a3 Lazy Load » Plugin Conflict: The Events Calendar’s widgets have their inline JSON break

  • KZeni

    (@kzeni)


    – What’s happening –
    It appears that the event countdown widget included with The Events Calendar Pro (https://theeventscalendar.com/products/wordpress-events-calendar/) breaks when a3 Lazy Load is activated on my site.

    I’m using the shortcode implementation of the countdown widget ([tribe_event_countdown]) within the content area of a page that’s then using the Block/Gutenberg editor with the new (v2) views/widgets included with The Events Calendar.

    – What appears to be the issue –
    From what I can tell, the inline JSON data that’s then used by the widget is being modified by a3 Lazy Load while it then doesn’t properly escape the quotation marks used in the code it’s inserting.

    Specifically, there’s a <script data-js="tribe-events-view-data" type="application/json"> element containing JSON code that then has “post_content”:”*post content*” within it. The post content for the event being pulled happens to have images, but then it has stuff like class="lazy lazy-hidden" added to that inline JSON content when it should be class=\"lazy lazy-hidden\" to not break the JSON.

    – Possible fix –
    I think it would make sense that a3 Lazy Load avoids any content within an element with type="application/json" (since that might be loaded onto the page after a3 Lazy Load is triggered) or otherwise have it make sure the code being added has its quotation marks escaped to not break the JSON being altered (then making sure a3 Lazy Load is triggered after inline JSON content might be shown yet.)

    For now, I’m either going to leave a3 Lazy Load disabled until fixed or finding a way to get a3 Lazy Load to avoid those images via its settings (though this should ideally not be necessary per the two possible fixes mentioned above.)

    • This topic was modified 1 month ago by KZeni. Reason: Updated title to show it might not just be the countdown widget in The Events Calendar Pro & could affect any of the widgets using inline JSON that might have an image in it
Viewing 1 replies (of 1 total)
  • Thread Starter KZeni

    (@kzeni)

    Come to think of it, this might actually affect more than the countdown widget included in The Events Calendar Pro.

    This could be problematic for any inline JSON code that might then have an image element that needs its quotation marks escaped to still have valid JSON code (including other widgets in The Events Calendar [free & Pro] among other plugins & implementations that simply have this situation come up).

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.