Closed entertainyou closed 8 years ago
Appreciates! It's a good solution to solve some initial problems. But in some situations like following:
<img data-src-origin="my-pic.jpg" data-src-thumbnail="my-pic-50x50.jpg" />
It can not work any more, so how about define the imgFallback
to be one of following types:
node.data('src')
instead of node.attr('src')
.imgFallback
, e.g.:
Function Get the source of image by imgFallback(node)
, e.g.:
{
imgFallback: function(node){
return node.attr('base') + '/' + node.attr('rel-path');
}
}
What do yo say?
I'll update the PR. Just to make sure, what you suggested is only applicable when src attribute is missing, right?
Pushed the update, and cheerio does not support .prop function, so only data-xxx or actual attribute is supported.
Merged, thanks!
src attribute is missing.