Skip to content

amp-img srcset behavior #1280

@Nemo64

Description

@Nemo64

I noticed some things about the <amp-img> srcset:

The amp documentation currently states that the srcset attribute is the same as on an <img> and that "The behavior will be polyfilled where not natively supported".

However: the native srcset is never used and the behavior differs in that the sizes attribute is not responsible for the image lookup (getLayoutRect is used if i read the code correctly). This is a mayor advantage over the native implementation in my opinion since this doesn't force me to hardcode my styles in the markup.

The documentation should mention the different implementation or the implementation should enforce the sizes attribute and use it to decide which image to use.

Personally: i think the current implementation is more advanced than the native one and since an amp document has a more stable layout than vanilla html there won't be any problems with it except that browser zooming doesn't change the used image.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions