2016-12-06 51 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; 
+ } 
相關問題