eKoopmans / html2pdf.js

Client-side HTML-to-PDF rendering using pure JS.
MIT License
4.13k stars 1.39k forks source link

Should I dispatch the load event on the cloned node by myself? #67

Open Alex1990 opened 6 years ago

Alex1990 commented 6 years ago

The below code bound the load event.

https://github.com/eKoopmans/html2pdf/blob/dbce51e917e32859cfb3890f0e4ec4e4e6d15eb7/src/utils.js#L52-L55

eKoopmans commented 6 years ago

Hi @Alex1990, the load event should be triggered automatically when the node is attached to a document, i.e.: https://github.com/eKoopmans/html2pdf/blob/50b768230199d7186919d40c8df402640c963f65/src/index.js#L124-L126

Is there an issue with it not firing?

Alex1990 commented 6 years ago

Yes. It's not triggered. I must trigger it manually.

eKoopmans commented 6 years ago

Okay, sounds like a problem. Can you provide an example? A Fiddle would be useful (see docs). Thanks!

Alex1990 commented 6 years ago

I just wonder where it states the load event will be triggered after appending the node to the document.

eKoopmans commented 6 years ago

Fair enough, this example looks like it's not firing the load event. I had borrowed cloneNode from html2canvas. I will investigate more tomorrow. Thanks!