3 ms·
Well, if you want to implement it optimally then you need to be doing srcsets and the easiest way to do them is to put the img width and height in the tag. Then
by Theodores 8y ago
Well, if you want to implement it optimally then you need to be doing srcsets and the easiest way to do them is to put the img width and height in the tag. Then run mod_pagespeed to tidy up the html. It then creates the srceset images. It will not be a solution to everyone's taste but it abstracts out the srcset bit to the server so you can have clean markup. If you are caching your pages at some level then it isn't going to be looking up image dimensions too often. Plus looking up image dimensions server side is a simple ask, no network needed.
I am going with the explicit image dimensions, srcsets and no lazy loading, which happens to be a feature of mod_pagespeed. With figure elements or picture elements for the content images, populated with the srcsets, I see this new browser side lazyload as the missing feature needed to preserve document structure, not have any javascript cludges and serve images in a way that respects data saving and viewport size.
Time to add the new 'lazy' attribute. Firefox and Safari users might not benefit yet but this is no need to wait.