To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more

Dawn 3.0.0 - html2canvas errors, theme js class extends to standard HTMLElement

nouvolo
Tourist
5 0 1

I have been trying to integrate html2canvas (https://github.com/niklasvh/html2canvas) into my custom Dawn theme (ver 3.0.0). However, whenever html2canvas runs, it tries to generate a screenshot (canvas), it needs to clone the whole page, and that's when error occurs. The errors mainly relates to the built in javascript of the theme when it tries to addEventListener.  Some of the rrror as follows:

 

TypeError: Cannot read properties of null (reading 'addEventListener')
at new DetailsDisclosure (details-disclosure.js?v=11862664082492452288:6:28)

 

TypeError: Cannot read properties of null (reading 'addEventListener')
at new DetailsModal (details-modal.js?v=451176189667266969:7:27)

 

TypeError: Cannot read properties of null (reading 'addEventListener')
at HTMLElement.setupEventListeners (predictive-search.js?v=3127871086358158403:14:10)

 

TypeError: Cannot read properties of null (reading 'querySelector')
at new ProductForm (custom-cablemod-product-form.js?v=6065484525017118644:7:17)

 

TypeError: Cannot read properties of null (reading 'addEventListener')
at new DetailsDisclosure (details-disclosure.js?v=11862664082492452288:6:28)
at new ShareButton (share.js?v=2305955673173102667:4:7)

 

TypeError: Cannot read properties of null (reading 'addEventListener')
at new ModalDialog (global.js?v=13896767922069093276:431:46)
at new ProductModal (scripts.js?49097:326:7)

 

There are some more from other theme scripts but basically I see the theme scripts with classes extend to HTMLElement..., isn't this a very bad practice, trying to extend to the standard DOM? I find it very difficult to debug and try to work around the errors. Anyway appreciate if someone can provide a solution to this...

 

e.g.  class DetailsDisclosure extends HTMLElement {...}

 

Replies 0 (0)