Skip to content

Commit

Permalink
fix: srcset resolve error
Browse files Browse the repository at this point in the history
  • Loading branch information
yujinpan committed Feb 3, 2021
1 parent d14b598 commit c4e3b5d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scripts/super-image-reptile.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,8 @@

// 兼容 srcset 属性
if (element.srcset) {
const srcs = element.srcset.split(',');
url = srcs.reduce((pre, curr) => {
curr = curr.trim();
return curr.includes(' ') ? curr.split(' ')[0] : curr;
}, '');
const srcs = element.srcset.split(' ');
url = srcs[0];
} else {
url = element.src;
// blob 类型可能被 revoke,这里生成 canvas
Expand Down

0 comments on commit c4e3b5d

Please sign in to comment.