The method, document.getElementByClassName returns HTMLCollection which is live. So, if an element selected by this array no longer qualifies for the selector, it will automatically be removed. There’s also a warning mentioned in MDN documentation for this method on this.
Also, forEach method is not available for this collection. Only length method is available. You would have to use Array.from method to convert results to an array and use forEach.
Maybe this situation didn’t occur before. It’s not related to our platform we believe.
Thank you for providing a detailed summary of the issue.
We are not sure how it worked before. Based on the code, it should not. As you already know, this is a web API and not something our platform provides. This will mostly depend on the browser and the version. Was there a change of browser environment or the way the code is executed changed? Or maybe the error occured before but was not observed?
Just for reference here is a JSFiddle that works the same way.
I would recommend to update the code to adhere to the standards.