Shopify themes, liquid, logos, and UX
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
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 {...}
User | RANK |
---|---|
118 | |
89 | |
73 | |
65 | |
46 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022