dom-to-image
dom-to-image copied to clipboard
Too big image file in Firefox
Use case:
I have a page with lots of css variables (around 1333) set in :root
, and each of them gets copied into each element inside the canvas, because apparently in Firefox, getComputedStyle
returns not only all styles, but all of the applied css variables as well.
Is it possible to add an option something like filterStyles
that we could use to filter out which computed styles we want to be included in the saved image and which not? We could use filtering by --
prefix to filter out CSS variables.
Expected behavior
await domtoimage.toJpeg(element,{
filterStyles(node, propertyName) {
return !propertyName.startssWith('__');
}
)
Actual behavior (stack traces, console logs etc)
Currently all 1300 css variables are set on each node, making the image file so big that it fails to be saved in Firefox
Library version
2.6.0
Browsers
- [ ] Chrome 49+
- [x] Firefox 45+