Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function cleanSrcset( srcset, width ){
const parsed = srcsetUtil.parse(srcset);
let cleanedSrcset
if( true ){
cleanedSrcset = getSmallestSrcset( parsed, width )
}else{
cleanedSrcset = noRetinaSrcset( parsed )
}
if( cleanedSrcset ){
return srcsetUtil.stringify(cleanedSrcset)
}else{
return false
}
}
// chrome.tabs.onUpdated.addListener(
if (a === 'srcset') {
try {
parsed = srcset.parse(value);
each(parsed, function(value) {
if (naughtyHref('srcset', value.url)) {
value.evil = true;
}
});
parsed = filter(parsed, function(v) {
return !v.evil;
});
if (!parsed.length) {
delete frame.attribs[a];
return;
} else {
value = srcset.stringify(filter(parsed, function(v) {
return !v.evil;
}));
frame.attribs[a] = value;
}
} catch (e) {
// Unparseable srcset
delete frame.attribs[a];
return;
}
}
if (a === 'class') {
value = filterClasses(value, allowedClassesMap[name]);
if (!value.length) {
delete frame.attribs[a];
return;
}
function cleanSrcset(srcset, width) {
const parsed = srcsetUtil.parse(srcset);
let cleanedSrcset;
switch (parseInt(store.getters.image_srcset)) {
case 1:
cleanedSrcset = noRetina(parsed);
break;
case 2:
cleanedSrcset = smallest(parsed, width);
break;
case 3:
cleanedSrcset = smart(parsed, width);
break;
}
if (cleanedSrcset) {
return srcsetUtil.stringify(cleanedSrcset);
} else {
return false;
}
}
updateText (pathsToUpdate) {
const imgSrcsetParts = this.imgSrcsetParts;
pathsToUpdate.forEach(function updatePath (path) {
const srcsToUpdate = _.filter(imgSrcsetParts, {url: path.oldPath});
srcsToUpdate.forEach((srcToUpdate) => {
srcToUpdate.url = path.newPath;
});
});
return srcset.stringify(imgSrcsetParts);
}
}
function absoluteSrcset(str) {
return srcset.stringify(
srcset.parse(str).map(item => ({
...item,
url: new URL(item.url, doc.baseURI).href
}))
);
}
className={css(styles.image)}
srcSet={srcset.stringify(imageSrcset)}
src={fallbackSrc}
/>
{overlay && (
<div>
<img src="{fallbackOverlay}" srcset="{srcset.stringify(overlaySrcset)}">
</div>
)}
{(title || description) && (
<div>
{title && <div>{title}</div>}
{description && (
<div>
{renderMarkdown({ text: description })}
</div>
)}
</div>
)}