html-to-image icon indicating copy to clipboard operation
html-to-image copied to clipboard

toSvg, toPng, etc Got TypeError: e.toDataURL is not a function on 1.11.6 onwards

Open kmcheung12 opened this issue 1 year ago • 1 comments

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

  1. Create a typescript based browser extension
  2. Add html-to-image as dependency
  3. Screen capture document.body on example.com
  4. Reproducible example at https://github.com/kmcheung12/html-to-image-bug-reproduction
  5. Working behaviour with version 1.11.5 in branch https://github.com/kmcheung12/html-to-image-bug-reproduction/tree/older-but-working
  6. 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 avatar Mar 15 '23 23:03 kmcheung12

👋 @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.

biiibooo[bot] avatar Mar 15 '23 23:03 biiibooo[bot]