Add/lazy loading
Description
This is a collection of backports to add image lazy loading from upstream. Included are: https://core.trac.wordpress.org/changeset/47554 https://core.trac.wordpress.org/changeset/48170 https://core.trac.wordpress.org/changeset/48237 https://core.trac.wordpress.org/changeset/48239 (in addition to existing Issue) https://core.trac.wordpress.org/changeset/48272 https://core.trac.wordpress.org/changeset/48648 https://core.trac.wordpress.org/changeset/48649
48239 was included as it introduced additional checks for lazy loading and the commit was not captured in upstream tickets. It was noted in the backport of 48272 where a unit test broke, this test was contingent on the changes made in 48239
Motivation and context
Closes #538 and will enable lazy loading of images including filter for sites to opt out if needed
For further consideration are the backports for iframe lazy loading and the performance improvements in change 52065
How has this been tested?
This PR includes unit tests for new functionality.
Screenshots
N/A
Types of changes
- New feature
There is some work on going to see that lazy loading is a little more performant. https://make.wordpress.org/core/2021/12/29/enhanced-lazy-loading-performance-in-5-9/ As this gets close to a fully ready PR, we might need to revisit.
PR updated and tests now passing with merge of develop changes.
We need to decide if we include: https://core.trac.wordpress.org/changeset/52065
We need to decide if we include: https://core.trac.wordpress.org/changeset/52065
This was worked upon as an improvement to reduce the drag of loading the images/iframes coming up first on page load.. I think it is a good one.
This pull request has been mentioned on ClassicPress Forums. There might be relevant details there:
https://forums.classicpress.net/t/add-lazy-loading-by-default-to-cp-core/2907/7
Two review on comment thread above, merging.