Skip to content

WooCommerce Lazy Images Compat inline JS issue #14281

Closed

Description

When WooCommerce is active, Jetpack adds the following inline JS regardless of whether lazyload is enabled or not:

jQuery( 'body' ).bind( 'wc_fragments_refreshed', function() { jQuery( 'body' ).trigger( 'jetpack-lazy-images-load' ); } );

It's inline script, so if jQuery is deferred (done normally for performance reasons), this causes a jQuery is not defined error.

Source: https://github.com/Automattic/jetpack/blob/master/3rd-party/woocommerce.php#L105

I assume two things have to change:

  • Check if Lazyload is even enabled.
  • Ensure jQuery exists by executing on window.onload event. Or have it in a normal JS file with jQuery dependency rather than inline JS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions