-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/5987: Lazyload bg css #6039
Conversation
and exclude:
DOMException: Failed to execute 'querySelectorAll' on 'Document': ', .elementor-34848 .elementor-element.elementor-element-0ceebb6 > .elementor-motion-effects-container > .elementor-motion-effects-layer' is not a valid selector. Note: Their background image lazyload feature (Elementor > Settings > Features > LazyLoad Background Images) should be disabled.
lazyload-css.min.js?ver=3.15-alpha1:1 DOMException: Failed to execute 'querySelectorAll' on 'Document': 'media(max-width: 1200px)' is not a valid selector. Note: In a row, select settings and use an external URL image:
Also, paths like style
:
":root{--wpr-bg-dee3f782-6db1-4327-aab9-a78013f72949: url('https://wprocketest.test/../../../../../../../../themes/flatsome/assets/img/[email protected]');}" If that's actually used somewhere it will result in
DOMException: Failed to execute 'querySelectorAll' on 'Document': 'media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)' is not a valid selector.
at https://wprocketest.test/wp-content/plugins/wp-rocket/assets/js/lazyload-css.min.js?ver=3.15-alpha2:1:953
at Array.forEach (<anonymous>)
at https://wprocketest.test/wp-content/plugins/wp-rocket/assets/js/lazyload-css.min.js?ver=3.15-alpha2:1:920
at 1 (https://wprocketest.test/wp-content/plugins/wp-rocket/assets/js/lazyload-css.min.js?ver=3.15-alpha2:1:1078)
at i (https://wprocketest.test/wp-content/plugins/wp-rocket/assets/js/lazyload-css.min.js?ver=3.15-alpha2:1:245)
at o (https://wprocketest.test/wp-content/plugins/wp-rocket/assets/js/lazyload-css.min.js?ver=3.15-alpha2:1:403)
at https://wprocketest.test/wp-content/plugins/wp-rocket/assets/js/lazyload-css.min.js?ver=3.15-alpha2:1:420 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What a huge PR :D I'm still checking it but some comments below.
@CrochetFeve0251 good job, The code is clean, although it came at the expense of complexity :D :D but that's a good trade-off.
}); | ||
} | ||
|
||
rocket_css_lazyload(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are loading the script directly when the file is loaded but page is still loading at this time so what about something like:
(function(callback) {
if (document.readyState !== "loading") {
callback();
} else {
document.addEventListener("DOMContentLoaded", callback);
}
})(() => {
rocket_css_lazyload();
});
Description
This feature allows us to lazy load images in the CSS.
Fixes #5987
Type of change
Please delete options that are not relevant.
Is the solution different from the one proposed during the grooming?
Yes.
Some classes were changed to make testing easier.
The selector have been removed from the name of CSS variables as it wasn't valid.
How Has This Been Tested?
Checklist:
Please delete the options that are not relevant.