html-to-image
html-to-image copied to clipboard
toSvg, toPng, etc Got TypeError: e.toDataURL is not a function on 1.11.6 onwards
Expected Behavior
Used in a web browser extension, can obtain rendered image of an html element
Current Behavior
For version 1.11.6 (inclusive) onward, it gives error TypeError: e.toDataURL is not a function
on APIs
toPng
, toSvg
and toCanvas
. (Unverified on the rest of public APIs). Version 1.11.5 is working as intended
Possible Solution
The introduction of isInstanceOfElement
in 1.11.6's cloneChildren
might be the cause. The comparison logic in isInstanceOfElement
might be not completely equivalent to older version
Steps To Reproduce
- Create a typescript based browser extension
- Add html-to-image as dependency
- Screen capture
document.body
on example.com - Reproducible example at https://github.com/kmcheung12/html-to-image-bug-reproduction
- Working behaviour with version 1.11.5 in branch https://github.com/kmcheung12/html-to-image-bug-reproduction/tree/older-but-working
- Screenshots available in the repo
Error Message & Stack Trace
TypeError: e.toDataURL is not a function
Additional Context
Your Environment
- html-to-image: 1.11.6+
- OS: macOS Catalina 10.15.7
- Browser: firefox 111.0
👋 @kmcheung12
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.