skip to Main Content

Html – Why isn't my custom element being garbage-collected?

Consider a webpage that contains a button which triggers the opening of a modal: <dialog></dialog> <button>Open modal</button> const trigger = document.querySelector(`button`); const wrapper = document.querySelector(`dialog`); trigger.addEventListener(`click`, () => { wrapper.replaceChildren(new Modal()); wrapper.showModal(); }); The modal is a custom element: class…

VIEW QUESTION
Back To Top
Search