Shopify themes, liquid, logos, and UX
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 |
---|---|
63 | |
58 | |
48 | |
42 | |
41 |
Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023With 2-Factor Authentication being required to use Shopify Payments, we’re here to help yo...
By Imogen Apr 26, 2023