qq15725 / modern-screenshot

📸 Quickly generate image from DOM node using HTML5 canvas and SVG
https://toolpkg.com/html-to-image
MIT License
504 stars 36 forks source link

Inline SVG with use tag that reference external file doesn't work and potentially crashes #43

Closed strindhaug closed 1 year ago

strindhaug commented 1 year ago

Steps To Reproduce

When trying to generate an image from html containing an SVG with a use tag that references an external file, it doesn't work. And if the url contains a query-string for cache busting or other characters that is invalid in a querySelector it will cause a javascript crash.

Example: Playground for https://codesandbox.io

Error Message & Stack Trace

```txt Uncaught (in promise) DOMException: Document.querySelector: 'svg external-symbol.svg?cacheBust=123#icon' is not a valid selector At https://unpkg.com/modern-screenshot:7 S https://unpkg.com/modern-screenshot:1 S https://unpkg.com/modern-screenshot:1 At https://unpkg.com/modern-screenshot:7 ``` ...etc

Your Environment