我想可能是amp-html有个bug。这段代码在两个实例Srcset cannot have both width and dpr sources上都生成了这个错误
由AMP⚡超文本标记语言支持-版本1480633190770
<amp-img srcset="
/assets/projects/a/600/b-600.jpg 600w,
/assets/projects/a/960/b-960.jpg 960w,
/assets/projects/a/1280/b-1280.jpg 1280w"
layout="fixed"
src="/assets/projects/a/b.jpg"
width="266.66666666666663"
height="150"></amp-img>发布于 2016-12-07 19:08:01
我发现了这个related issue,正如@dvoytenko所说,这是一个已经通过在srcset URL中使用逗号修复的错误。
您可能还希望在Match commas in the URLs for srcset中检查给定的修复,并查看here的全部更改。
除此之外,此GitHub post - Validator Roll-Up还提供了以下示例代码,它可能也会有所帮助:
// Srcset cannot have both width and dpr sources
+ if (hasWidth && hasDpr) {
+ this.is_successful_ = false;
+ return;
+ }https://stackoverflow.com/questions/40998732
复制相似问题