Javascript – How can I prevent a DOM node removed from its tree from being held by spurious strong references, like from closures?
For a toy example, suppose I have a clock widget: { const clockElem = document.getElementById('clock'); const timefmt = new Intl.DateTimeFormat( 'default', { timeStyle: 'medium', }); setInterval(() => { const d = new Date; console.log('tick', d); clockElem.querySelector('p').innerHTML = timefmt.format(d); }, 1000);…