Description
Thanks @mfranzke for linking to my WP Plugin. I actaully wanted to tell you but forgot about it and then found it already in the readme.
As always I spend way more time on this then expected. The latest versions do not wrap any element that is already wrapped in noscript
and also I made a change that I do not wrap the the very first element inside the the_content
and put loading=eager
on it. This polyfill does nothing with eager
right? And wrapping it would be counterproductive as that needs the JS to execute first b4 the image would be loaded right?
If you or anyone reading this has any suggestions for the plugin please let me know.
I recently after I first released my plugin found this https://wordpress.org/plugins/native-lazyload/ by google. It got a lot of negative feedback. I skimmed the code and they do include a script but let it load with defer
and make it only execute once. I like this more as you can async load it in the head, makes way more sense to me. As for the PHP code its seems quite complex, possibly bloated. Mine takes only ~150 lines so far. There are special hoops they have to jump because their script is not working on later loaded images.