This looks like the kind of problem
caused by using regular expressions to filter HTML content. Regular expressions are very poorly suited to the job of dealing with HTML and getting the filtering right becomes a game of whack-a-mole, as we can see here. If the content's going to a browser, it should be parsed with the same tools that a browser uses. To suppose that a "parser" built using completely different technology can stay current is talk from imagination-land.