making a queue of DomNodes to remove seems to work

You can't remove DOMNodes from a DOMNodeList as you're iterating over
them in a foreach loop
Though, making a queue of items to remove seems to work