Closed mdouek closed 10 months ago
Note: the commit message is wrong should be "only bump i when link isnt removed"
Hmm. Interesting. Is the view returned by getElementsByTagName
dynamic in all browsers? So it does shrink when a matching item gets removed? Either way, it might make things cleared to keep the loop as-is, but copy the result of getElementsByTagName
to a static array before the loop to avoid the dynamic nature of this array in the first place... (In fact, MDN suggests something similar: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection)
@TobiX I took your advice and just created a static array, makes things easier. sorry for all the commits. I can create a new branch with the one commit and a new PR to keep git cleaner.
All fine, I can simply squash all changes.
When iterating over the list , if a link is removed the list gets one element shorter which was causing things to be skipped over. Switched to only bumping i if nothing is removed. This was breaking the favicon replacement as "alternate icon" was getting skipped over. Tested by building own plugin and testing own environment.
Testing done