Skip to content

Auto-sizes: fall back to next value in sizes if the image is not lazy-loading #9648

@zcorpan

Description

@zcorpan

This may be somewhat off-topic (please feel free to redirect me, if so) but one aspect of the parsing algorithm is still unclear to me. If a platform (e.g. WordPress) generated image markup that looks like this (note the omission of a loading="lazy" attribute):

<img src="200.jpg" width="200" height="200" srcset="200.jpg 200w, 400.jpg 400w, 600.jpg 600w" sizes="auto, 200px" />

Would the omission of the loading attribute cause sizes to be calculates as the default 100vw value, would the 200px value be respected, or would size containment come into play? I would hope that the the "200px" value would be respected in this case so that platforms could add auto to the beginning of a sizes and dynamically decide whether to add a loading attribute while constructing the markup. In other words, if auto can't be applied because the image is not being lazy loaded, then the browser should respect the next items in the media condition.

Originally posted by @joemcgill in #9493 (comment)

Falling back to the next value seems like it could be useful. Maybe make it conforming also.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions