My "speedrun": var simulateClick = function (elem) { // Create our event (with options) var evt = new MouseEvent('click', { bubbles: true, cancelable: true, view: window }); // If cancelled, don't dispatch our event var canceled = !elem.dispatchEvent(evt); }; var run = () => { var el = document.querySelector('input[type=checkbox]:not(:checked)') simulateClick(el) } setInterval(run, 100)
Your speedrun code can be reduced to this:
setInterval(() => document.querySelector('input[type=checkbox]:not(:checked)').click(), 100)
It would be significantly improved by the addition of :enabled and then reduction of interval time.