Closed nextend closed 1 year ago
Have supported
<img src="error.webp" style="width: 100px; height: 100px;">
{
fetch: {
placeholderImage: cloned => {
const div = document.createElement('div')
div.style.background = 'grey'
div.style.display = 'inline-block'
for (let i = cloned.style.length - 1; i >= 0; i--) {
const name = cloned.style.item(i)
div.style.setProperty(
name,
cloned.style.getPropertyValue(name),
cloned.style.getPropertyPriority(name),
)
}
cloned.parentNode?.insertBefore(div, cloned)
return 'data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
},
},
}
I would like to replace images which was unable to load for the screenshot (mostly CORS errors). I would like to generate grey area where these images are. What I would need is a callback for
placeholderImage
where the first parameter is the original img element.Another idea: replace the img tag in the cloned document with a simple div with styling.