tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.23k stars 1.68k forks source link

Uncaught (in promise) error when using .toBlob with text "%26" #308

Open samfeder opened 4 years ago

samfeder commented 4 years ago

Use case: description, code

My code is working 99.9999% of the time:

domtoimage.toBlob(document.getElementById('feedback-details'), {
              filter: (node) => {
                return !(node.hasAttribute ? node.hasAttribute('data-hideFromSaveImage') : false);
              }
            })
              .then((blob) => {
                FileSaver.saveAs(blob, 'my-node.png');
              });
}

Expected behavior

Actual behavior (stack traces, console logs etc)

when my node has an encoded URL with an ampersand, like this: https://www.edx.org/course?subject=Data%20Analysis%20%26%20Statistics, I get the attached error. I also get the error when I change the URL to just %26.

Screen Shot 2019-08-28 at 10 54 51 AM

Library version

2.5.2

Browsers

q215171650 commented 4 years ago

me too

wujunchuan commented 1 year ago

me too