2016-12-06 24 views
1

认为可能存在amp-html的错误。此代码生成在这两种情况下这个错误, Srcset cannot have both width and dpr sourcesamp-html Srcset不能同时具有宽度和dpr源

技术AMP⚡HTML - 版本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> 

回答

0

我发现这个related issue并经@dvoytenko说,这是它已经一个bug已通过在srcset网址中使用逗号进行修复。

您可能还想检查给定的修复程序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; 
+ } 
相关问题